apc overviewjp2003 12– l2 : 1.5 mb (shared cache with 2 procs., 4~8 way assoc.) – l3 : 32 mb...

40
1 ミレニアムプロジェクトIT21 アドバンスト並列化コンパイラ 早稲田大学理工学部 コンピュータ・ネットワーク工学科 笠原博徳 アドバンスト並列化コンパイラ プロジェクトリーダ http://www.kasahara.elec.waseda.ac.jp http://www.apc.waseda.ac.jp

Upload: others

Post on 31-May-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

1

ミレニアムプロジェクトIT21アドバンスト並列化コンパイラ

早稲田大学理工学部コンピュータ・ネットワーク工学科

笠原博徳アドバンスト並列化コンパイラ

プロジェクトリーダhttp://www.kasahara.elec.waseda.ac.jp

http://www.apc.waseda.ac.jp

Page 2: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

2

自動並列化コンパイラの必要性• 21世紀は“Multiprocessor Everywhere”の時代

– 組み込み用プロセッサからスーパーコンピュータまで» チップマルチプロセッサ(携帯電話,ゲーム,PDA,PC):IBM

Power4» デスクトップワークステーション:Sun Ultra80

4processorWS » エントリーレベルサーバ:Sun V880 8 processor server» ハイエンドサーバ:IBM pSeries690 server (RegattaH)» 世界最速スーパーコンピュータ:地球シミュレータ

– チップマルチプロセッサが組み込み機器からスーパーコンピュータまでの競争力を左右

– アプリケーションソフトの充実(生産性向上)、短システム開発期間、低コスト化が市場競争力決定<例>携帯電話・ゲーム

• システムの実質性能、価格性能比、ソフトウェア生産性の向上を実現する自動並列化コンパイラの開発が重要

http://www.sun.com/desktop/products/ultra80/

Page 3: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

3

IBM Power4 Chip Multiprocessor

J. M. Tendler, J. S. Dodson, J. S. Fields, Jr., H. Le, and B. Sinharoy," POWER4 system microarchitecture",IBM Journal of Research and Development, Vol46, No. 1, 2002

http://www-1.ibm.com/servers/eserver/pseries/hardware/whitepapers/power4.html

Page 4: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

4

IBM pSeries690 RegattaH• Up to 16 Power4: 32 way SMP Server

– L1(D) : 64 KB (32KB/processor, 2 way assoc.), L1(I): 128 KB (64KB/processor, Direct map)– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.)– L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB]

GXGX

P

L2

PP

L2

P

P

L2

P P

L2

P

GXGX

P

L2

PP

L2

P

P

L2

P P

L2

P

GX

GX

P

L2

PP

L2

P

P

L2

P P

L2

P

GX

GX

GX

GX

GX

P

L2

PP

L2

P

P

L2

P P

L2

P

GX

GX

GX

GX

GX

MemSlot

GX Sl ot

L3 L3 L3 L3L3 L3L3 L3

L3 L3

L3 L3

L3 L3L3 L3 L3 L3

L3 L3

L3 L3

L3 L3

L3 L3

L3 L3

L3 L3

L3 L3

MCM 1

MCM 3MCM 2

MCM 0

GX Slot

MemSlot

MemSlot

MemSlot

MemSlot

MemSlot

MemSlot

MemSlo t

GX Slot

GX Sl ot

Four 8-way MCM Featur es Assembled into a 32-way pSer ies 690

IBM @server pSeries690 Configuring for Performance

http://www-1.ibm.com/servers/eserver/pseries/hardware/whitepapers/p690_config.html

Page 5: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

5

アドバンスト並列化コンパイラ技術

開発目標: 実効性能の倍増

技術開発項目①アドバンスト並列化技術の開発②並列化コンパイラ性能評価技術の開発

伸びが鈍化

IT,バイオ技術、デバイス技術開発、地球環境、次世代VLSI設計、金融,気象予測、エネルギー、宇宙航空開発、自動車開発、電子商取引

波及効果①国際競争力の高い次世代PC、HPCの開発②独創的自動並列化コンパイラ技術の実用化③競争力に優れた次世代プロセッサ

チップの開発 (シングルチップ・マルチプロセッサ開発)と市場獲得

④様々の分野での研究開発促進  

背景と課題①並列処理:PCからHPCまでのコア技術②ITにおけるソフトウェアの重要性増大③価格性能比、使いやすさの達成が必須性能

1980

HPCの理論性能と実効性能の推移年20001990

理論性能曲線(カタログ性能)

ギャ

ップ

拡大

実効性能曲線(実際にアプリケーションを 動作させた時の性能)

本技術開発

目標①価格性能比の向上②実質性能の向上③使い易さの向上   

研究共同体:早大,富士通 ,日立, 産総研,  委託先:JIPDEC  期間: 2000.9.8 –2003.3.31再委託:東工大、電通大、東邦大

政府ミレニアムプロジェクトIT21(経済産業省,NEDO)

Page 6: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

6

JIPDEC (Japan Information Processing Development Corporation)JIPDEC (Japan Information Processing Development Corporation)

Project Leader : Prof. Hironori KASAHARA (Waseda Univ.)

(administrative corporation: Contractor of APC Project)

APC Propulsive SectionAPC Propulsive Section

METI (Ministry of Economy, Trade and Industry)METI (Ministry of Economy, Trade and Industry)

NEDO (New Energy and Industrial Technology Development Organization)NEDO (New Energy and Industrial Technology Development Organization)

investment

contract

Hitachi Ltd.12

Toho Univ.1

Univ. of Electro-Communications1

Tokyo Institute of Technology1

Waseda Univ.6 (+ Students)

AIST (National Institute of Advanced Industrial Science and Technology)3

Fujitsu Ltd.11

Participating OrganizationNum. of Members : 35

http://www.nedo.ne.jp/

http://www.meti.go.jp/

Page 7: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

7

JIPDEC (Japan Information Processing Development Corporation)JIPDEC (Japan Information Processing Development Corporation)

Project Leader : Prof. Hironori KASAHARA (Waseda Univ.)Sub-Leaders : Assoc. Prof. Hayato YAMANA (Waseda Univ.)

Dr. Hanpei KOIKE (AIST)

Central Laboratory (APC Lab.) – Waseda Univ.Central Laboratory (APC Lab.) – Waseda Univ.

Group of Advanced Parallelizing Compiler Technology

Group of Advanced Parallelizing Compiler Technology

Group of Performance Evaluatiojn for Parallelizing Compiler

Group of Performance Evaluatiojn for Parallelizing Compiler

(administrative corporation: Contractor of APC Project)

APC Propulsive SectionAPC Propulsive Section

Group Leader: Tokuro ANZAKI (Hitachi)Group Leader: Koh HOTTA (Fujitsu)

Fujitsu Ltd.(*)Hitachi Ltd.(*)AIST(**) (National Institute of Advanced Industrial Science and Technology)

Waseda Univ.(**)Toho Univ.(***)

Fujitsu Ltd.(*)Hitachi Ltd.(*)Tokyo Institute of Technology (***)Univ. of Electro-Communications(***)Waseda Univ.(**)

(*) Researchers of Fujitsu and Hitachi are on loan to JIPDEC(**) Joint Research contractors (**) Subcontractors

Int’l Advisory Board•Prof. David A. Padua•Prof. Monica S. Lam •Prof. Rudolf Eigenmann •Prof. Francois Irigoin

Page 8: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

8

APC研究推進活動・自主評価n推進委員会 研究開発進め方,平成12年度(1回),平成13年度(1回), 14年度(1回)n技術委員会 目標設定, 研究計画,研究会の進め方, 年度末報告,

成果発表法,予算,平成12年度(3回),13年度(8回),14年度(9回)計20回

n開発技術研究会 研究計画,研究報告, 議論, 海外調査報告,<ネットワーク集中研活動に加え>12年度(10回), 13年度(20回),14年度(16回)計46回

n国際協調委員会 海外との協調, 目標設定の妥当性, 成果の海外へのアピール,評価委員会の参考として世界的権威による評価(第1回) 平成13年9月5日~6日, (第2回)平成15年3月20日~21日

n国際シンポジウム APC成果発表, 世界の権威による評価 平成15年3月20日nインターナショナルアドバイザリボード <“国際的発展”への一対応>²Prof. Padua (Univ. of Illinois) 並列コンパイラの世界的権威Parafrase , Cedar, Polaris ²Prof. Lam(Stanford Univ.) Suif, NCI(National Compiler Infrastructure), Suif Explorer           コンパイラ、チューニングツール分野で最も著名な研究者の一人 ²Prof. Eigenmann(Purdue Univ.) Polarisコンパイラ, SPEC HPC性能評価の権威²Prof. Irigoin(Ecole des Mines de Paris) PIPS Parallelizer手続き間解析、欧州のリーダの一人

評価概要l並列化コンパイラによる2倍の速度向上は、米国における経験では18年の期間を要したが、APCは2倍をほぼ18ヶ月で達成した。この成果は素晴らしい。l超高性能コンピュータのハードでは地球シミュレータが世界一であるがAPCの成果により高性能コンピュータ用のソフトでも日本が世界一になった。l競合他社が協力して成功したのはユニーク。米国なら1社と協力。

Page 9: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

9

海外における並列化コンパイラ研究状況• ループ自動並列化(イリノイ大、メリーランド大、スタンフォード大)

• データ依存解析 – GCD, Banerjee’s inexact / exact, Omega, シンボリック解析,

IPA(手続き間解析), シンボリック解析, 実行時解析, etc

• ループリストラクチャリング(自動プログラム変換)– アンローリング, ストリップマイニング, ループ融合, ユニモジューラ変換(スキューイング,リバーシング,インターチェンジ), アレイプライベタィゼーション, タイリング, etc

イリノイ大:Polaris, Parafrase2, Promise(UC Irvineと共同)

スタンフォード大: SUIF, NCI(National Compiler Infrastructure)n 成熟期に達し、今後の大幅な性能向上困難(アムダールの法則)Ø 複雑なイタレーション間データ依存・制御依存による逐次ループ存在Ø ループ回転数がプロセッサ数より少ない場合の階層的並列化必要

l マルチレベル並列処理イリノイ大:PROMIS compilerプロジェクトカタルーニャ工科大:NANOS compiler (NthLIB, extended OpenMP)

Page 10: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

10

マルチグレイン並列化の必要性l HPC:ループ並列化の限界

Ø 技術的成熟, 並列化困難なループの存在Ø プロセッサ増加と共に無視していた逐次ループが性能向上に悪影響

(アムダールの法則)

• マイクロプロセッサ:命令レベル並列性の限界Ø 主流のスーパースカラ/VLIWは命令レベル並列性の利用のみØ 集積度向上と共にハードウェア複雑化(命令発行数増加/機能ユニッ

ト増加/投機実行/分岐予測等)しているが使用トランジスタ数に対しスケーラブルな性能向上困難 (2-3倍が上限) 

² プロセッサ数・トランジスタ数の増加に対しスケーラブルな性能向上を可能とするアーキテクチャ及びコンパイル技術必要

• マルチグレイン自動並列化– シングルチップ・マルチプロセッサからHPCまでの実効性能,価格

性能比, 使い易さを向上– マルチグレインコンパイラと協調して最高性能を出すアーキテクチャ

の開発により競争力のあるHPC,マイクロプロセッサの開発

Page 11: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

11

アドバンスト並列化コンパイラプロジェクトにおける研究開発技術

l 自動マルチグレイン並列化技術の開発– マルチグレイン並列性抽出技術

(ループ並列性+粗粒度タスク並列性+(近)細粒度並列性)

– データ依存解析技術 (手続き間解析,実行時解析)

– 自動データ分散技術 (分散キャッシュ,分散共有メモリの有効利用)

– 投機的実行技術  (ハードウェア利用率向上):産総研との協力

– スケジューリング技術 (負荷バランス,データ転送オーバーヘッド最小化)

– 並列性記述言語拡張版の作成  ( OpenMPのコンパイラモジュール間中間言語としての利用)

l 並列化チューニング技術の開発– プログラム可視化技術, 動的情報活用技術

l 性能評価技術– 個別機能評価手法の開発– 総合性能評価手法の開発

Page 12: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

12

OSCAR 並列化コンパイラにおけるマルチグレイン並列化

• 粗粒度タスク並列性– サブルーティン, ループ,基本ブロック間の並列性– コンパイル時のスタティックスケジューリングと実行時のダイナミックスケジューリングを各階層の並列性等により使い分け、タスクをプロセッサあるいはプロセッサグループへスケジューリング。

• ループ並列性– ループイタレーション間の並列性– イタレーション集合をプロセッサへスケジューリング

• (近)細粒度並列性– 基本ブロック内代入文間並列性– スタティックにプロセッサにスケジューリング

l 各並列性を階層的に組み合わせた利用

Page 13: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

13

Generation of coarse grain tasksnMacro-tasks (MTs)

ä Block of Pseudo Assignments (BPA): Basic Block (BB)ä Repetition Block (RB) : natural loopä Subroutine Block (SB): subroutine

Program

BPA

RB

SB

Near fine grain parallelization

Loop level parallelizationNear fine grain of loop bodyCoarse grainparallelization

Coarse grainparallelization

BPA

RBSB

BPARBSB

BPARBSBBPARBSB

BPARBSBBPARBSB

1st. Layer 2nd. Layer 3rd. LayerTotalSystem

Page 14: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

14

Earliest Executable Condition Analysis for coarse grain tasks

(Macro-tasks)

A Macro Flow Graph

A Macro Task Graph

Page 15: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

15

Automatic processor assignment in 103.su2cor

• Using 14 processors– Coarse grain parallelization within DO400 of subroutine LOOPS

Page 16: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

16

MTG of Su2cor-LOOPS-DO400

DOALL Sequential LOOP BBSB

n Coarse grain parallelism PARA_ALD = 4.3

Page 17: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

17

APC Compiler Organization

Parallelizing Tuning System

Program Visualization Technique

Techniques for Profiling & Utilizing Runtime Info

Feedback-directed Selection Technique of

Compiler Directives

- Hierarchical Parallel- Affine Partitioning

MultigrainParallelizationSource

Program

FORTRAN

OpenMPCode

Generation

APC Multigrain Parallelizing Compiler

Feedback

- Cache optimization- DSM optimization

Automatic DataDistribution

- Static Scheduling- Dynamic Scheduling

Scheduling

- Inter-procedural- Conditional

Data DependenceAnalysis

- Coarse Grain- Medium Grain- Architecture Support

SpeculativeExecution

RuntimeInfo

Variety of Shared Memory Parallel machines

SUNUltra 80

IBMpSeries690

IBMRS6000

IBM XL FortranVer.8.1

Sun Forte 6Update 2

IBM XL FortranVer.7.1

Page 18: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

18

Code Generation Using OpenMP• Compiler generates a parallelized program using

OpenMP API• One time single level thread generation

– Threads are forked only once at the beginning of a program by OpenMP “PARALLEL SECTIONS”directive

– Forked threads join only once at the end of program

• Compiler generates codes for each threads usingstatic or dynamic scheduling schemes

• Extension of OpenMP for hierarchical processing is not required

Page 19: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

19

マルチグレイン並列処理の実行イメージ 集中

スケジューラコード

分散スケジューラコード

P0 P1 P2 P3

Processor group0 (PG0)

MT1_1

SYNC SEND SYNC RECV

P4 P5 P6 P7

1_3_2

1_3_4

1_3_3

1_3_1

1_3_2

1_3_4

1_3_3

1_3_11_2_2

1_2_4

1_2_3

1_2_1

1_2_6

1_2_5

1_2_2

1_2_4

1_2_3

1_2_1

1_2_6

1_2_5

1_2_2

1_2_4

1_2_3

1_2_1

1_2_6

1_2_5

Processor group1 (PG1)

MT1_1

MT1_2SB

MT1_3RB

1st layer

2nd layer

1_3_21_3_31_3_4

1_3_1

MT1-3 MT1-2

1_2_1

1_2_2

1_2_5

1_2_6

1_2_4

1_2_7

1_2_3

近細粒度並列化コード

Page 20: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

20

0.0

2.0

4.0

6.0

8.0

10.0

12.0

tomca

tvsw

imsu

2cor

hydro

2d mgrid

applu

turb3

d apsi

fpppp

wave5

wupwise

swim

2k

mgrid2

k

applu

2k

sixtra

ckap

si2k

Spe

edup

ratio

XL Fortran(max)

OSCAR(max)

Performance of Multigrain Parallelization on 16 processor High-end Server IBM pSeries690

23.1s

19.2s

3.8s

16.7s

38.3s

3.4s

21.5s

7.1s

21.0s

3.0s

16.4s

3.1s

23.2s

14.1s

37.4s 39.5s

39.5s27.8s35.1s30.3s21.5s 126.5s 307.6s 291.2s 279.1s

126.5s

115.2s

38.5s

107.4s

28.8s

184.8s279.1s

• IBM XL Fortran for AIX Version 8.1– Sequential execution : -O5 -qarch=pwr4– Automatic loop parallelization : -O5 -qsmp=auto -qarch=pwr4– OSCAR compiler : -O5 -qsmp=noauto -qarch=pwr4

(su2cor: -O4 -qstrict)

22.5s 85.8s 18.8s

22.5s 85.8s 18.8s

282.4s 321.4s

282.4s 321.4s

Page 21: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

21

Performance of Multigrain Parallel Processing for 102.swim on IBM pSeries690

0.00

2.00

4.00

6.00

8.00

10.00

12.00

14.00

16.00

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Processors

Spee

d up

rat

ioXLF(AUTO)

OSCAR

Page 22: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

22

It makes clone procedures, propagates constants beyond procedure boundaries,and evaluates expressions at compile time.

subroutine f(x,m)if (m=1) then

call g(x)else if (m=2) then

call h(x)endif

call f (x,1)

call f (x,2)

Aggressive Constant Propagation

call clone_f (x,1)

call f (x,2)

subroutine clone_f(x,m)call g(x)subroutine f(x,m)call h(x)

Page 23: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

23

do i=1, n...

call f(x,y)...

end dodo j =1,n...

end do

!$OMP PARALLEL!$OMP DOdo i=1, ncall f(x, y)

enddo!$OMP END DO NOWAIT!$OMP DOdo j=1, n

...enddo

!$OMP END DO!$OMP END PARALLEL

Interprocedural ParallelizationIt can parallelize the loops including procedure calls and enclose contiguous parallel loops in one parallel region.

Page 24: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

24

SPEC CFP95 turb3d on Origin 2000

Performance of InterproceduralAnalysis

Interprocedural Analysis in APC compilerMIPSPro Fortran V.7.30

0

5

10

15

1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31

MIPS PRO

APC IPA

100%pararell

50%pararell

Page 25: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

25

Affine Partitioning [Lim & Lam97]

- A lot of transformations can be done automatically

- The followings are considered at the same time

l improve data localityl reduce synchronization overhead

l parallelization

- Extract pipeline parallelism

Page 26: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

26

Generated pipelined code in OpenMP

Consider parallelexecution order

j

k

P0

P1

P2

myklb

mykub

do j = 1, ny-2waitPrev()

do k = myklb, mykub......

enddosignalToNext()

enddo

Page 27: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

27

Speedup of applu on HP Alpha Server (8 Processors) by Affine Partitioning

0

1

2

3

4

5

1 2 3 4 5 6 7 8The number of CPUs

Spe

edup

apcpara

Page 28: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

28

Data-Localization Loop Aligned Decomposition

• Decompose multiple loop (Doall and Seq) into CARs and LRsconsidering inter-loop data dependence.– Most data in LR can be passed through LM.– LR: Localizable Region, CAR: Commonly Accessed Region

DO I=69,101DO I=67,68DO I=36,66DO I=34,35DO I=1,33

DO I=1,33

DO I=2,34

DO I=68,100

DO I=67,67

DO I=35,66

DO I=34,34

DO I=68,100DO I=35,67

LR CAR CARLR LR

C RB2(Doseq)DO I=1,100

B(I)=B(I-1)+A(I)+A(I+1)

ENDDO

C RB1(Doall)DO I=1,101

A(I)=2*IENDDO

RB3(Doall)DO I=2,100

C(I)=B(I)+B(I-1)ENDDO

C

Page 29: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

29

データローカライゼーションのイメージ

MTG 4分割後のMTG 2プロセッサへの割り当て

Page 30: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

30

DO 200 J=1,NDO 200 I=1,M

UNEW(I+1,J) = UOLD(I+1,J)+1 TDTS8*(Z(I+1,J+1)+Z(I+1,J))*(CV(I+1,J+1)+CV(I,J+1)+CV(I,J)2 +CV(I+1,J))-TDTSDX*(H(I+1,J)-H(I,J))

VNEW(I,J+1) = VOLD(I,J+1)-TDTS8*(Z(I+1,J+1)+Z(I,J+1))1 *(CU(I+1,J+1)+CU(I,J+1)+CU(I,J)+CU(I+1,J))2 -TDTSDY*(H(I,J+1)-H(I,J))

PNEW(I,J) = POLD(I,J)-TDTSDX*(CU(I+1,J)-CU(I,J))1 -TDTSDY*(CV(I,J+1)-CV(I,J))

200 CONTINUE

DO 300 J=1,NDO 300 I=1,M

UOLD(I,J) = U(I,J)+ALPHA*(UNEW(I,J)-2.*U(I,J)+UOLD(I,J))VOLD(I,J) = V(I,J)+ALPHA*(VNEW(I,J)-2.*V(I,J)+VOLD(I,J))POLD(I,J) = P(I,J)+ALPHA*(PNEW(I,J)-2.*P(I,J)+POLD(I,J))

300 CONTINUE

DO 210 J=1,NUNEW(1,J) = UNEW(M+1,J)VNEW(M+1,J+1) = VNEW(1,J+1)PNEW(M+1,J) = PNEW(1,J)

210 CONTINUE

UNVOZ

PNVN UOPO CVCUH

UNPNVN

UNVOPNVN UO

PO

U PV

An Example of Data Localization for Spec95 Swim

0 1 2 3 4MBcache size

(a) An example of target loop group for data localization

(b) Image of alignment of arrays on cache accessed by target loops

Cache line conflicts occurs among arrays which share the same location on cache

Page 31: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

31

PARAMETER (N1=513, N2=513)

COMMON U(N1,N2), V(N1,N2), P(N1,N2),* UNEW(N1,N2), VNEW(N1,N2),1 PNEW(N1,N2), UOLD(N1,N2),* VOLD(N1,N2), POLD(N1,N2),2 CU(N1,N2), CV(N1,N2),* Z(N1,N2), H(N1,N2)

Data Layout for Removing Line Conflict Misses by Array Dimension Padding

Declaration part of arrays in spec95 swim

PARAMETER (N1=513, N2=544)

COMMON U(N1,N2), V(N1,N2), P(N1,N2),* UNEW(N1,N2), VNEW(N1,N2),1 PNEW(N1,N2), UOLD(N1,N2),* VOLD(N1,N2), POLD(N1,N2),2 CU(N1,N2), CV(N1,N2),* Z(N1,N2), H(N1,N2)

before padding after padding

Box: Access range of DLG0

4MB 4MB

padding

Page 32: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

32

Performance of Cache Optimization with Padding on Sun Desktop WS Ultra80 (4 processors)

96.7

115.4 76.9

65.9

19.0

21.3

30.7

55.6

120.7 198.3 141.3 190.9

0.0

1.0

2.0

3.0

4.0

5.0

6.0

7.0

8.0

9.0

10.0

tomcatv swim hydro2d turb3d

Programs

Spee

dup

ratio

forteoscar w/ padding

Page 33: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

33

First Touch Control Method for Distributed Shared Memory Systems

11: c FTC loop12: !$omp parallel do13: do i=41, 10041, 10014: A(i)=015: enddo

1: real A(100)

21: c Initialization loop22: !$omp parallel do23: do i=1, 1001, 10024: A(i)= 025: enddo

・・・31: c Kernel loop32: do itr=1, 1000033: !$omp parallel do34: do i=41, 10041, 10035: A(i)= ...36: enddo37: enddo

(a) Example program 1

(c) First touch control method

Inserted at the head of execution part

Generate the dummy loop to imitate reference patterns

11: c Data distribution directive

12: c$distribute A(block)

(b) Conventional methodInserted in the declaration part

Page 34: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

34

1

1

1

pe0

pe0

RR : remote referenceL : local reference

(a) conventional data distribution

(b) reference region of kernel loop

(c) region of remote reference

1pe0(d) data distribution

by our method pe0

pe3pe2pe1

pe1 pe3pe2

RL L

pe1 pe2 pe3pe125 5540

50

75

10070 85

25

40

40 55

70

70

75

85

85

100

100

100

Image of Data Distribution by First Touch Control

(both methods)

100% local reference !!

Page 35: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

35

!$omp parallel dodo j = 1, ndo k = rowstr(j), rowstr(j+1)-1sum = sum + a(k) * p(colidx(k))

enddoq(j) = sum

enddo

(b) a (c) colidx (d) rowstr

1 2 3 4 5 6 7 8 1 1,1 1,1 1 1 (1)2 2,2 2,2 2 2 (1)3 3,3 3,6 3,8 3,3 3,6 3,8 3 6 8 5 (3)4 4,1 4,4 4,6 4,1 4,4 4,6 1 4 6 8 (3)5 5,2 5,5 5,2 5,5 2 5 10 (2)6 6,6 6,6 6 11 (1)7 7,5 7,7 7,5 7,7 5 7 13 (2)8 8,4 8,7 8,8 8,4 8,7 8,8 4 7 8 16 (3)

1,1 2,2 3,3 3,6 3,8 4,1 4,4 4,6 5,2 5,5 6,6 7,5 7,7 8,4 8,7 8,8

(a) original sparse matrix(a)original sparse matrix (b)a (c)colidx (d)rowstr

(e) on memory

(f) In the case of a block distribution

Algorithm and Data of CG

Page 36: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

36

Speedup for CG (class B)by First Touch Control on Origin 2000 (32 processors)

0

5

10

15

20

25

30

35

1 6 11 16 21 26 31Number of processors

Speedup

os-FTco-DIRco-FTCMPIlinear

6.6 times

1.3 times1.2 times

os-FT: original, co-DIR: add data distrib. directive,co-FTC: proposed FTC method

Page 37: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

37

APCコンパイラのハイエンドサーバIBM pSeries690(16プロセッサ )上での処理性能

115.2s

126.5s18.8s85.8s22.5s37.4s23.2s

16.4s

21.0s21.5s

16.7s

19.2s

107.4s

184.8s

302.9s 342.4s

105s(1.8倍)

28.8s(3.7倍)

38.5s(3.0倍)

28.9s(4.4倍)

18.8s(1.0倍)

85.8s(1.0倍)

3.5s(10.7倍)

13.0s(1.8倍)

3.1s(5.3倍)

7.1s(3.0倍)

3.0s(7.0倍)

3.4s(4.9倍)

3.8s(5.1倍)

22.5s(1.0倍)

302.9s(1.0倍)

342.4s(1.0倍)

0.0

2.0

4.0

6.0

8.0

10.0

12.0

tomcatv swim su2cor hydro2d mgrid applu turb3d apsi fpppp wave5 wupwise swim mgrid applu sixtrack apsi

逐次

処理

に対

する

速度

向上

IBM XL Fortran Ver.8.1APC compiler

23.1s 38.3s 21.5s 30.3s 35.1s 27.8s 39.5s 22.5s 85.8s 18.8s 126.5s 307.6s 291.2s 279.1s 302.9s 342.4s

SPEC95fp SPEC2000fp

逐次処理時間:

*各バーの数字はIBM社製最新コンパイラXL Fortran Ver. 8.1(青)と、開発したAPCコンパイラ(赤)による各プログラムの処理時間[s:秒]を示す。 APCコンパイラによる処理時間横のカッコ内は、IBMコンパイラに比べAPCコンパイラが何倍処理速度を向上できるかを示している。

Page 38: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

38

APCコンパイラのIBM RS6000 (8プロセッサ)上での処理性能

3859s1842s

3803s

1328s1755s

1741s529s501s280s555s487s

193s

426s200s

218s

364s

1328s(2.9倍)

859s(1.5倍)

1115s(1.6倍)

333s(5.2倍)

90s(6.2倍)

143s(3.4倍)

87s(2.2倍)

115s(3.7倍)

97s(2.1倍)

109s(2.0倍)

89s(4.1倍)

3859s(1.0倍)

1842s(1.0倍)

529s(1.0倍)

501s(1.0倍)

280s(1.0倍)

0.0

2.0

4.0

6.0

8.0

10.0

12.0

tomcatv swim su2cor hydro2d mgrid applu turb3d apsi fpppp wave5 wupwise swim mgrid applu sixtrack apsi

逐次

処理

に対

する

速度

向上

率IBM XL Fortran Ver.7.1APC compiler

637s 1044s 492s 988s 592s 705s 555s 280s 501s 529s 1741s 7896s 5520s 6051s 1842s 3859s

SPEC95fp SPEC2000fp

逐次処理時間:

*各バーの数字はIBM社製コンパイラXL Fortran Ver. 7.1(青)と、開発したAPCコンパイラ(赤)による各プログラムの処理時間[s:秒]を示す。 APCコンパイラによる処理時間横のカッコ内は、IBMコンパイラに比べAPCコンパイラが何倍処理速度を向上できるかを示している。

Page 39: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

39

APCコンパイラのSun Ultra80 (4プロセッサ)上での処理性能

1313s763s1094s

579s1046s870s98s387s58s194s

133s

22s

77s

31s115s

97s

1313s(1.0倍)

763s(1.0倍)

878s(1.2倍)

569s(1.0倍)962s

(1.1倍)

216s(4.0倍)

98s(1.0倍)

387s(1.0倍)

58s(1.0倍)

56s(3.5倍)

92s(1.4倍)

21s(1.1倍)31s(2.5倍)

30s(1.0倍)

21s(5.4倍)

19s(5.1倍)

0.0

1.0

2.0

3.0

4.0

5.0

6.0

7.0

8.0

9.0

10.0

tomcatv swim su2cor hydro2d mgrid applu turb3d apsi fpppp wave5 wupwise swim mgrid applu sixtrack apsi

逐次

処理

に対

する

速度

向上

率Sun Forte6 Update2APC compiler

121s 198s 70s 141s 97s 172s 201s 58s 387s 98s 881s 1139s 846s 1453s 763s 1313s

SPEC95fp SPEC2000fp

逐次処理時間:

*各バーの数字はSun社製コンパイラForte 6 Update 2(青)と、開発したAPCコンパイラ(赤)による各プログラムの処理時間[s:秒]を示す。 APCコンパイラによる処理時間横のカッコ内は、IBMコンパイラに比べAPCコンパイラが何倍処理速度を向上できるかを示している。

Page 40: APC overviewJP2003 12– L2 : 1.5 MB (shared cache with 2 procs., 4~8 way assoc.) – L3 : 32 MB (external, 8 way assoc.) [x 8 = 256 MB] GX GX P L2 P P L2 P P L2 P P L2 P GX GX P L2

40

APCプロジェクトの主要成果<目標> 世界より10年遅れていた国内産業界の技術をAPC開始時点(2000年9月)の共有

メモリ型マルチプロセッサ上で市販コンパイラと比べ性能を2倍向上させる。<成果>l IBM最新鋭ハイエンドサーバpSeries690 16プロセッサ上でSPECベンチマーク

CFP95, CFP2000 16 プログラム に対し、IBM最新コンパイラXL Fortran Ver.8.1に比べ平均3.5倍、最大10.7倍と目標を大きく上回ることに成功

l 査読付き論文:45件, 研究会論文:43件, 全国大会論文:15件 ,特許申請:8件, 招待講演:9件, 情処学会解説APC :1件, 新聞記事:10件, Webニュース: 20件, 博士号取得:5名。

l 開発技術は 環境、バイオインフォマティクス、自動車、金融工学等高性能コンピュータを使う各種分野における競争力強化に貢献可能。

l 開発技術は参加企業により製品化開始。すでに一部発売。

<国際協調委員会評価:世界からの評価>Ø 高性能コンピュータ用のソフトウェアで日本が世界一。Ø 並列化コンパイラによる2倍の速度向上は、米国における経験では18年の期間

を要したが、APCは2倍をほぼ18ヶ月で達成したのは驚異的。

<IT21評価助言会議平成15年7月18日:評価抜粋>Ø 当初の目標を、十分以上に達成している。コンパイラという困難な分野で世界

に冠たる成果を出したのは、実に素晴らしい。

Ø 成果は米国のこの分野のキーパースンからも評価されており、従来米国に相当遅れているといわれていたこの分野において米国を凌駕する並列コンパイラ技術を構築したことは、本プロジェクトの成果である。