講義用の計算機の使い方 計算機アーキテクチャ特論 (Advanced Computer Architectures) マルチコアプロセッサ 吉瀬謙二計算工学専攻 kise _at_ cs.titech.ac.jp www.arch.cs.titech.ac.jp W831 講義室木曜日 9:00 10:30 ユーザ名 advance で serv.arch.cs.titech.ac.jp にログイン linux など ssh advance@serv.arch.cs.titech.ac.jp 講義時に伝えたパスワードでログイン 学籍番号でディレクトリを作成して, そこで作業する. mkdir myname cd myname M-Core プロジェクト : メニーコアプロセッサの研究 教育を支援する実用的な基盤環境 http://www.arch.cs.titech.ac.jp/mcore/ 1 2 マルチコア (2 個 ~ 数 10 個 ) からメニーコアへ アウトオブオーダ実行 : Tomasulo のアプローチ (1967) コンピュータ (PC) チップ マルチコアプロセッサ デスクトップ PC 等に搭載される高性能 汎用プロセッサのアーキテクチャは, 今後, 数百個のコアを搭載するメニーコアプロセッサの時代へ Dual core 現在 今後 Many-core processor ( メニーコアプロセッサ ) Quad core IBM 360/91 の浮動小数点ユニットでは アウトオブオーダ実行を行う洗練された方式が採用されていた Robert Tomasulo によって発明されたこの手法では 命令が必要とするオペランドがいつ利用できるかを探知し RAW ハザードを最尐化 レジスタリネーミングを導入して WAW ハザードと WAR ハザードを回避 近年のプロセッサでは この手法のさまざまなバリエーションが採用されているが これら 2 つの重要な概念は共通の特徴 3 4 世界初のマイクロプロセッサ (1971) VAX 11/780 (1978) 1 native MIPS VAX 命令 (Complex Instruction Set Computer) MOVL @40(R4), 30(R2) ; M[M[40+R4]] <- M[30 + R2] MOVC3 @36(R9), (R10), 35(R11) R1 <- 35 + R11, R3 <- M[36 + R9] for (R0 <- M[R10]; R0!=0; R0--) { M[R3] <- M[R1]; R1++; R3++; } R2 = 0; R4 = 0; R5 = 0; プロセッサ 出荷年 トランジスタ数 4004 1971 2,250 出典 : フリー百科事典 ウィキペディア (Wikipedia), Intel ミュージアム 5 1 native MIPS 6 1
Growth in clock rate of microprocessors Growth in processor performance From CAQA 5 th edition 7 From CAQA 5 th edition 8 ムーアの法則によるトランジスタ数の増加 ポラックの法則 ムーアの法則チップで利用できるトランジスタの数は 2 年間で 2 倍に増加する プロセッサ 出荷年トランジスタ数 4004 1971 2,250 8008 1972 2,500 8080 1974 5,000 8086 1978 29,000 286 1982 120,000 386 processor 1985 275,000 486 DX processor 1989 1,180,000 Pentium processor 1993 3,100,000 Pentium II processor 1997 7,500,000 Pentium III processor 1999 24,000,000 Pentium 4 processor 2000 42,000,000 ムーアの法則に従ってトランジスタ数が増加してきた. 今後も同様の増加が見込まれる. 出典 : Intel 社, http://www.intel.com/research/silicon/mooreslaw.htm 9 10 アウトオブオーダ実行プロセッサ マルチコア (2 個 ~ 数 10 個 ) からメニーコアへ Instruction cache Instruction flow Single-ISA Heterogeneous Multi-Core Architectures: The Potential for Processor Power Reduction, MICRO-36 Branch handler Fetch RS Integer Decode Rename Register file Operand Fetch Floating-point dataflow 数世代の RISC プロセッサのサイズ ALU ALU FP ALU FP ALU Adr gen. Adr gen. Reorder buffer Register dataflow Store queue Data cache 11 2
マルチコア (2 個 ~ 数 10 個 ) からメニーコアへ マルチコアプロセッサの例 Cell Broadband Engine (2005) 8 core (SPE) + 1 core (PPE) PS3, IBM Roadrunner(12k) PlayStation3 の写真は PlaySation.com (Japan) から Platform 2015: Intel Processor and Platform Evolution for the Next Decade Diagram created by IBM to promote the CBEP, 2005 WIKIPEDIAより IEEE Micro, Cell Multiprocessor Communication Network: Built for Speed 14 Cell/B.E. Element Interconnect Bus マルチコアプロセッサの例, Intel Sandy Bridge IEEE Micro, Cell Multiprocessor Communication Network: Built for Speed Arch Lab. TOKYOTECH 2008-07-22 メニーコアプロセッサの例, Intel SCC メニーコアプロセッサモデル M-Core メニーコアプロセッサシミュレータ SimMc Intel Single-Chip Cloud Computer (48 Core) 3
M-Core プロジェクト M-Core: Many Core Architecture Model Off chip memory modules (banks) & switch Conventional I/O (1, 0) (2, 0) (3, 0) (8, 0) Conv. Core (0, 0) (1, 1) (1, 2) (2, 1) (2, 2) (3, 1) (3, 2) (8, 1) (8, 2) 未実装 (1, 8) (2, 8) (3, 8) (8, 8) 19 20 ノード Core A ノード Local Core ID & rank 8 ビットの整数 x, y を用いて,(x, y) の座標によりコアを指定する.x, y は 0~255 の値をとる. ただし, x = 0 及び y = 0 は特別なユニットを表現するために予約する. y = 0 も使わない. Core ID は x,y の順序の連結により生成される 16 ビットで表現する. Conv. Core (0, 0) (1, 1) (1, 2) (2, 1) (2, 2) (3, 1) (3, 2) (8, 1) (8, 2) コア ID 0 0 ID_X ID_Y (1, 1) (1, 2) (2, 1) (2, 2) (3, 1) (3, 2) (8, 1) (8, 2) 32 16 8 0 (1, 8) (2, 8) (3, 8) (8, 8) (1, 8) (2, 8) (3, 8) (8, 8) 21 22 Library: Multi-Core library MClib test10 int MC_init(int *id_x, int *id_y, int *rank_x, int *rank_y); void MC_finalize(); void MC_dma_put(int dst_id, void *remote_addr, void *local_addr, size_t size, int remote_stride, int local_stride); void MC_dma_get(int get_id, int local_id, void *remote_addr, void *local_addr, size_t size, int remote_stride, int local_stride); int MC_printf(char *format,...); void MC_puts(char* s); int MC_sprintf(char *buf, char *format,...); int MC_sleep(int n); int MC_clock(unsigned int*); etc 23 24 4
Library: Multi-Core library MClib test22 int MC_init(int *id_x, int *id_y, int *rank_x, int *rank_y); void MC_finalize(); void MC_dma_put(int dst_id, void *remote_addr, void *local_addr, size_t size, int remote_stride, int local_stride); void MC_dma_get(int get_id, int local_id, void *remote_addr, void *local_addr, size_t size, int remote_stride, int local_stride); int MC_printf(char *format,...); void MC_puts(char* s); int MC_sprintf(char *buf, char *format,...); int MC_sleep(int n); int MC_clock(unsigned int*); etc 25 26 Library: Multi-Core library MClib test31 int MC_init(int *id_x, int *id_y, int *rank_x, int *rank_y); void MC_finalize(); void MC_dma_put(int dst_id, void *remote_addr, void *local_addr, size_t size, int remote_stride, int local_stride); void MC_dma_get(int get_id, int local_id, void *remote_addr, void *local_addr, size_t size, int remote_stride, int local_stride); int MC_printf(char *format,...); void MC_puts(char* s); int MC_sprintf(char *buf, char *format,...); int MC_sleep(int n); int MC_clock(unsigned int*); etc 27 28 ネットワークアーキテクチャ Bus Network トポロジ メッシュ (mesh) スイッチング Warm hole, no virtual channel フロー制御 Xon / Xoff ルーティング XY Dimension Order Routing Bidirectional network switch Processor node N processors, 1 switch ( ), 1 link (the bus) Only 1 simultaneous transfer at a time NB (best case) = link (bus) bandwidth * 1 BB (worst case) = link (bus) bandwidth * 1 29 30 5
inbuf Ring Network Crossbar (Xbar) Network N processors, N switches, 2 links/switch, N links N simultaneous transfers NB (best case) = link bandwidth * N BB (worst case) = link bandwidth * 2 If a link is as fast as a bus, the ring is only twice as fast as a bus in the worst case, but is N times faster in the best case N processors, N 2 switches (unidirectional), 2 links/switch, N 2 links N simultaneous transfers NB = link bandwidth * N BB = link bandwidth * N/2 31 32 2D and 3D Mesh/Torus Network Core & block diagram SimMips Core North out in Mesh Torus inbuf N processors, N switches, 2, 3, 4 (2D torus) or 6 (3D torus) links/switch, 4N/2 links or 6N/2 links West in out inbuf XBAR Switch inbuf out in East N simultaneous transfers NB = link bandwidth * 4N or link bandwidth * 6N BB = link bandwidth * 2 N 1/2 or link bandwidth * 2 N 2/3 in out South 34 Architecture Packet および Flit の構成 Input port X+ ARB ラウンドロビン Output port X+ フリット (flit) は 38ビットの固定長とする stride header tailer 32bit Input port X- Input port Y+ Output port X- Output port Y+ address valid data payload Input port Y- Input port XBAR Switch Output port Y- Output port 1 1 0 0 0 0 header 1 0 1 0 0 0 address 1 0 0 1 0 0 stride 1 0 0 0 1 0 data 1 0 0 0 1 1 data 35 36 6
Packet および Flit の構成 Library: Multi-Core library MClib パケット (packet) は 1 つの header flit, 1~9 個の address, stride, data flit であり, 最後のフリットは tailer のフラグを立てることによって構成される. パケットは最長で 10flit である. フリット (flit) のサイズは 38 ビットの固定長とする. 最長のパケット Header flit Body flit Body flit Body flit Tailer flit 10flit int MC_init(int *id_x, int *id_y, int *rank_x, int *rank_y); void MC_finalize(); void MC_dma_put(int dst_id, void *remote_addr, void *local_addr, size_t size, int remote_stride, int local_stride); void MC_dma_get(int get_id, int local_id, void *remote_addr, void *local_addr, size_t size, int remote_stride, int local_stride); int MC_printf(char *format,...); void MC_puts(char* s); int MC_sprintf(char *buf, char *format,...); int MC_sleep(int n); int MC_clock(unsigned int*); etc 37 38 DMA 転送 : MC_dma_put MC_dma_put の流れ Local-Core ~ ローカルコアの保持するデータリモートコアのメモリに転送. 下の例は, コア A が MC_dma_put を呼び出し, コア B にデータを送る場合. Local 2 3 パケットを生成 4 フリット ノード (local) ノード (remote) ヘッダ情報 Core A Local データ Core B Local mapped I/O 1 Core A remote_id remote_addr local_addr size(byte) remote_stride local_stride cmd 39 40 Core to Core の通信タイミング 通信遅延 posedge clk clk Core A store A - buf header addr data A - buf header addr data B - buf header addr data Conventional I/O Off chip memory modules (banks) & switch Conv. RISC Module (0, 0) (0, 1) (0, 2) (0, 3) (0, 8) (1, 1) (2, 1) (1, 2) (2, 2) (3, 1) (3, 2) (8, 1) (8, 2) B - buf header addr data Core B load (1, 8) (2, 8) (3, 8) (8, 8) 性能を重視したタイミング 41 Node 42 7
Single Bus Multiprocessor 単一バス結合のマルチプロセッサ, 共有メモリ ネットワーク結合のマルチプロセッサ, 分散メモリ Proc1 Proc2 Proc3 Proc4 Caches Caches Caches Caches Proc1 Proc2 Proc3 Proc4 Single Bus Caches Caches Caches Caches I/O Caches are used to reduce latency and to lower bus traffic Must provide hardware to ensure that caches and memory are consistent (cache coherency) Must provide a hardware mechanism to support process synchronization Network 43 44 アナウンス 講義スライド, 講義スケジュール www.arch.cs.titech.ac.jp 休講になることがあります. 注意してください. 45 8