VLIW ( Very Long Instruction Word ) & マルチスレッドプロセッサ ( Multi-Thread...

32
VLIW Very Long Instruction Word & ママママママママママママ Multi-Thread Processor • VLIW Super Scalar マママママママママママママ Parallel processing with Instruction level like Super Scalar • MT (Multi-Thread) Processor • マママママママママママ Thread Level parallel processing • ママ マママママママママ () MT Simultaneous (Throughput oriented) MT Super scalar ママママママママママママママママママ Thread level processing on top of a super scalar processors • マママ Mixture SMT & VLIW ママ マChikara Fukunaga 1

description

VLIW ( Very Long Instruction Word ) & マルチスレッドプロセッサ ( Multi-Thread Processor ). VLIW Super Scalar のような命令レベル並列処理 Parallel processing with Instruction level like Super Scalar MT (Multi-Thread) Processor スレッドレベル並列処理 Thread Level parallel processing - PowerPoint PPT Presentation

Transcript of VLIW ( Very Long Instruction Word ) & マルチスレッドプロセッサ ( Multi-Thread...

Page 1: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

1

VLIW ( Very Long Instruction Word ) &

マルチスレッドプロセッサ( Multi-Thread Processor )

• VLIW• Super Scalar のような命令レベル並列処理

Parallel processing with Instruction level like Super Scalar• MT (Multi-Thread) Processor

• スレッドレベル並列処理Thread Level parallel processing

• 同時(スループット指向) MTSimultaneous (Throughput oriented) MT

• Super scalar の上にスレッドレベル並列処理を重ねるThread level processing on top of a super scalar processors

• 混合型 Mixture ( SMT & VLIW )福永 力; Chikara Fukunaga

Page 2: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

2

Multi-Thread Processor• MT=Multi-Thread (ここで thread とはプログ

ラム並列処理単位:ループ、関数)Thread is a unit for parallel processing in a process; Loop or Function

• ここではスパスカラーを利用せず従来型のスカラープロセッサを利用( no. of ways=1 )A conventional scalar processor will be used for this MT processing.

• 自分自身で thread を切り替えるThe hardware makes the context-switch of threads.

福永 力; Chikara Fukunaga

Page 3: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

3

細粒度あるいはインタリーブ MTFine Granularity or Interleaved MT

• 細粒度( Fine Granularity or Interleaved ) MT :クロックあるいは命令ごとに thread 切り替えThreads are executed one by one with clock or instruction.

福永 力; Chikara FukunagaMIPS® MT Principles of Operation Document Number: MD00452 2007 より

Page 4: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

4

粗粒度あるいはブロック MTCoarse Granularity or Blocked MT

• 粗粒度( Coarse Granularity or Blocked ) MT :キャッシュ・ミスなど長期ストール時に thread 切り替え(別名( a.k.a. ): Switch on Event MT : SoEMT )Switching of Threads is done at a long stall like cache miss or IO access

福永 力; Chikara FukunagaMIPS® MT Principles of Operation Document Number: MD00452 2007 より

Page 5: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

5

スーパスカラの非効率さInefficiency of Super scalar processors

• (注意)今までのスパースカラプロセッサは命令レベルの並列性( ILP )に着目していた.A Super scalar is a parallel processor at the instruction level.

• しかし例え n 命令同時並列処理( n-ways )の能力があっても IPC はせいぜい n/2 程度、資源の半分は使われないままという研究結果がある.IPC is estimated to be only n/2 even if a super scalar has n-way pipelines. Efficiency can not be higher than 50%.

福永 力; Chikara Fukunaga

Page 6: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

6

スループット指向 MT プロセッサ

Throughput oriented MT Processor• スーパスカラを多数の thread を並列処理する

プロセッサに改変させればその問題が解決できてスループット( throughput )も向上する(だろう).If a super scalar is used as MT processor , throughput will be expected to increase.

• スレッドコンテキスト( PC とレジスタ)をthread 分用意Thread data units (PC and registers) are implemented with the number equal to the max. threads expected.

福永 力; Chikara Fukunaga

Page 7: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

7

スループット指向 MT プロセッサの考え方

Ideas of Throughput Oriented MT Processors• 同時( Simultaneous ) MT :複数 thread 同時実行

Multiple threads can be executed simultaneously.• スーパスカラの埋まらないスロットを他のスレッ

ドからの命令で充填させればよい. Empty slots of multiple ways can be used for instructions of other threads. Then the efficiency will be higher.

福永 力; Chikara FukunagaMIPS® MT Principles of Operation Document Number: MD00452 2007 より

Page 8: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

8

SMT Processor 構造 structure• Extension of a simple super

scalar structure

福永 力; Chikara Fukunaga

Renaming structure for Multi-threads

Number of registers are increased

Instruction of a thread is selected

Page 9: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

9

スループット MT プロセッサ問題点Problems about

Throughput MT Processors• レジスタ数の増加・増大

( IPC かクロック周期かなんらかの犠牲が必要)Increase of number of Registers. We need to sacrifice performance (IPC and/or clock frequency)

• メモリ参照の増加 Increase of memory access( thread 単位で独立メモリ領域参照→キャッシュミスヒット) thread ごとのキャッシュ領域 =1/thread 数(Cache for each thread must be independently implemented→ Cache size reduction → cache miss) Cache size ~ 1/no. of threads

• Thread 数の限界:資源の半分が通常のスーパスカラで利用されているとしたら資源のフル利用には thread 数は多くても 2 、それ以上は無意味How many threads are really needed? Some study indicated Resource were most-effectively used with only two.

• 多重スレッドプログラム処理要求は高い?(数値計算・メディア処理→‥‥)In which application, such a processor will be used. Numerical processing, Multimedia ?

福永 力; Chikara Fukunaga

Page 10: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

10

MIPS32®34Kf™ プロセッサ Processor• MIPS 社開発 Multi-thread プロセッサ( 2006 )

Multi-thread processor developed by MIPS Technologies (2006)• 2 段階の多重 thread 構造( OS level/User level )

Multiple thread structure with two ranks • OS level thread → VPE ( Virtual Processing Elements ) ×Max. 2• User level thread → TC ( Thread Context ) ×Max. 9• TC はそれぞれ独自の PC と Register File ( RF )を持つ

Each TC has own PC and Register File (RF) • 単 OS 、異なる OS を各 VPE に導入できる

Single OS with one VPE orDifferent OS can be deployed toeach VPE

• いくつかの TCs を VPE に配置Several TCs/VPE

• QoS が TC 選択アルゴリズムを内蔵QoS contains TC selection Algorithm

福永 力; Chikara Fukunaga MIP

S te

chno

logi

es W

WW

site

から

Page 11: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

11

QoS in MT ASE による TC 選択TC selection with QoS in MT ASE

• 9 stage pipeline 基本構造( basic architecture ) +MT ASE & DSP ASE (Application Specific Extension)

• 利用者が ASE を特定用途向けに改造Customers can program ASE for their purpose

• TC 優先順位付け Policy manager in QoS of MT ASE の設定Setup of Policy manager in QoS of MT ASE for TC selection

• 例えば( Examples: )Prioritization or Round Robin TC selection/Cycle assignment to TCs

福永 力; Chikara Fukunaga

Policy Manager

Page 12: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

12

MIPS32®34Kf™ Block Diagram

• Fetch Unit はすべて TC から命令を受け取るFetch Unit receives instructionsfrom all TCs.

• Fetch Unit には Branch PredictionLogic (512 entries)

• 各 TC は IBF という 8 個命令収容の instruction buffer をもつEach TC has an instruction buffer(IBF) which can store 8 instructions

• TC Dispatch Unit は MT controlblock にある policy manager からの決定によりどの TC からの命令をとってくるか決めるTC Dispatch Unit selects TC toexecute the instruction. MT control block specify the TC.福永 力; Chikara Fukunaga

MIPS Technologies, MIPS32® 34KfTM Processor Core Datasheet ( 2008 )より

Page 13: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

13

EyeQ2 system with MIPS 34Kf• Embedded System Europe 8/9 2006 issue

福永 力; Chikara Fukunaga

Page 14: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

14

EyeQ2 • 道路交通状況の実時間ビジュアル解析システム

Road traffic condition vision analysis with max. two cameras input data

福永 力; Chikara Fukunaga

Page 15: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

15

EyeQ2 block diagram with 2 MIPS 34Kfs• 2 MIPS 34Kfs ( 1 つ将来拡張用)が使わ

れている2 MIPS 34Kfs are used (one is for future extension)

• 8 Visual Computing Engines• CE : Classifier Engine

• Image scaling & Preprocessing Unit• Pattern classifier

• Tracker:• Image warping and and Motion analysis

• PW: Pre-process Window• Image converter and pyramid unit• Computation of Vertical and horizontal edge

map• Filter:

• Feature based classify unit• Dfinder (Display Finder)

• Stereo engine• Programmable scan 2pixel/clock

• 3 Vector Microcode machines (VLIW)

福永 力; Chikara Fukunaga

Page 16: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

VLIW or EPIC• VLIW =Very Long Instruction Word or

EPIC =Explicitly Parallel Instruction Computer• 複数の Instruction を 1 つの非常に( Very )長い

( Long )語( Instruction Word )に詰め込み並列処理を目論むSeveral instructions are put into a very long instruction word at once.

• Word ( 100 〜 200bit より構成)はいくつかのブロック(プロセッサの処理ユニットに対応)に分解され,各ブロックは数 10bit でそのユニットの命令(+オペランド)を形作る.The word is divided into some blocks (O(10) bit size). One block corresponds to the instruction word of a conventional processor.

• つまり非常に長い命令語に複数命令を詰め込めるだけ詰め込みそれらを並列動作させようとするもの.Multiple instructions are stored in each block of the instruction word amap. The block has own computing system so that instructions in the word are able to be executed in parallel.

福永 力; Chikara Fukunaga 16

Page 17: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

17

VLIW or EPIC ( 2 )

• 現在までにさまざまなプロセッサが開発されていった.i860 という 64bit の LIW がある.整数計算浮動小数点計算を並列実行.Several LIW/VLIW were developed so far such as i860 which is LIW processor with 64bit instruction word.

• さらに Intel (主要開発は HP による)のItanium ( 2001.5 発売), Transmeta のCrusoe ( 2000.1 )などが市場に出回った.ともに x86命令を展開するので Windows系 PC に使われている.Intel (although the main developer was HP) VLIW called Itanium has been put on the market in May 2001 on the market, Transmeta has had Crusoe in Jan. 2001. Both processors are VLIW of x86 instructions. They have been used for Windows PCs.

福永 力; Chikara Fukunaga

Page 18: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

VLIW の概念Ideas of VLIW

• 例えば 148bit で 1 語の命令長.いくつかのブロックに分けられ各部分に対応する命令をプログラムから取ってきて組み込む.それらは並列処理される.Instruction word length=148bit with several blocks. Each block is used for a particular kind of instructions. Instructions are processed in parallel.

• スケジューリングハードウェアがないので回路は簡単,低消費電力A simple circuit and low power consumption because no complicated scheduling logic.

• プログラムから並列並びにハザードを考慮しながら命令を並べるのはソフトウェア(コンパイラあるいは変換ソフト)の仕事A compiler/translator software arranges the instructions intoappropriate blocks.

福永 力; Chikara Fukunaga 18

Page 19: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

命令の VLIWへの組み込みInstructions into VLIW blocks• 対応する命令が見つからない場合は NOP ( No OPeration )を詰

め込む.NOP (No operation) must be put into a block if no instruction candidate

• 効率的な並列処理は期待できない.動画データの解凍,表示,圧縮などの反復操作に有効か.Expected not efficient parallel processing. Effective for Moving picture?

• コンパイラに非常に多くのものを要求,依存しなければならない.Heavy duty for the compiler

• 構造上インオーダ発行、インオーダ終了となる.In order issue/in order completion福永 力; Chikara Fukunaga 19

Page 20: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

20

VLIW とスーパスカラVLIW and Superscalar

• VLIW はハードウェアの構成は単純、しかしThe Hardware structure of VLIW is simple, but

• 硬直化したスケジューリング:命令のインオーダ発行、インオーダ終了inflexible scheduling with in-order issue and completion

福永 力; Chikara Fukunaga

Compiler

instructions

Processors

ProcessorsScheduler

Page 21: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

VLIW 例:富士通 FR-V ( 550 )Example of VLIW : Fujitsu FR-

V ( 550 )• Parallel processing with max 8 instruction/28 calculations/clock

32kB I-cache (4 way set assoc.) and 32kB D-cache ( 4-set assoc. ) • 90nm CMOS Frequency 440MHz (upgraded in 2006)

• シングルチップ FR-V550 は 2006年改変されマルチコア化されMB93577 の型番で商品化されているFR-V550 has been upgraded to the multi-core chip with ID MB93577

福永 力; Chikara Fukunaga 21

http://jp.fujitsu.com/microelectronics/products/assp/frv/

64

Page 22: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

22

FR-V 8-way VLIW architecture

福永 力; Chikara Fukunaga

Page 23: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

23

FRV-550 でねらう用途Applications with FR-V550 cores

• Multimedia processing with low power consumption• Concurrent processing of Movie decoding (MPEG4/H.264

or MPEG2 decoding with 3D graphics)

• Bioinformatics simulation: Molecular Dynamics of Protein• High performance but low energy consumption and price.

福永 力; Chikara Fukunaga

Page 24: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

24

VLIW 問題点

• NOPs の増大による非効率な並列処理• 世代交代による新規 h/w 拡張(つまり

bit 数 /W の増加)に簡単に対応できない.プログラムの再コンパイルあるいは改造

• インオーダ終了により非効率なサイクル数の増加(早く終わった命令のアイドリング)

• ロード / セーブ命令のスケジューリング見積もりの不確定さ

• 細かく複雑な条件分岐を含むプログラムへの非力な適応

福永 力; Chikara Fukunaga

Page 25: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

25

EPIC ( Explicitly Parallel Instruction Computing )

• Intel 、 HP は EPIC なる概念のアーキテクチャ( IA64 )を共同開発.Intel and HP together have developed a new architecture IA64 in the framework of EPIC

• VLIW だがその欠点を克服It is VLIW in principle, but its drawback is tried to eliminate

• 両社は Itanium という名称のプロセッサを制作した( 2001 )They have put a new EPIC processor Itanium in market in 2001

福永 力; Chikara Fukunaga

Page 26: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

26

Itanium Architecture• 128 ビットに 3 つの命令(各 41 ビット)と 5 ビットの「 template」と呼ばれるフィールドをもつ.3 instructions with each for 41 bit block + 5bit field called “template”

• この 128 ビットの命令ワードを「 bundle」と呼ぶ128 IW is called “bundle”

• この命令を実行する( 1 )かしない( 0 )かを保持するレジスタを指定 predicate部に指定A register to execute this instruction (1) or not (0) is specified in Predicate field

福永 力; Chikara Fukunaga

Page 27: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

27

Itanium Instructions and Template• 命令はハードウェアユニットの利用か

らいくつかのタイプに分類できる.Instructions can be divided into several types according to the main hardware unit.

• template でハードウェア資源ユニットの数を考慮した並列できる命令の組み合わせを示す. template で規定された組み合わせは独立であることが保証される.

Template specifies a combination of instructions which can be put into three slots in bundle.

• template の例 ExampleMII, MI|I, MLX, MMI, M|MI, MFI, MMF, MIB, MBB, BBB, MFB …

MFI = M inst. (slot 0) F in slot 1 I in slot 2| は conflict が発生した場合の次のサイクルへの先送り( stop )| indicates that the instruction after it will be done in the next cycle if conflict may occur

A 型命令は I-unit でも M-unit でも処理可能 Type A can be put into either I or M 福永 力; Chikara Fukunaga

命令型Instruction

type意味

Description

実行ユニットExecution unit

A Integer ALU I- or M-unit

I Non-ALU integer

I-unit

M Memory M-unit

F Floating -point F-unit

B Branch B-unit

L+X* Extended I-unit or B-unit

* Long integer or Long Branch

Page 28: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

Itanium ブロック図 Block diagram• Itanium 1 分岐ユニット( B ) ×3 、整数 (I)×4 、メモリ( M ) ×4 、浮動小数点( F ) ×2 個Itanium 1 Branch unit (B)×3, Integer (I)×4, Memory (M)×4, Floating Point (F)×2

• Itanium 2 分岐ユニット( B ) ×3 、整数 (I)×6 、メモリ( M ) ×6 、浮動小数点( F ) ×2 個Itanium 2 Branch unit (B)×3, Integer (I)×6, Memory (M)×6, Floating Point (F)×2

福永 力; Chikara Fukunaga 28

Page 29: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

29

Itanium Bundle Rotation と並列処理and Parallel Processing

• 命令の実行例(通常 2 bundles 同時実行)Example of instructions (Simultaneous execution of two bundles normally) template MFI & MIB

• Stop 処理と bundle次回まわし( rotation )Stop process and bundle rotationtemplate MII & M|MI

• ここで 2 サイクルで 9 個の命令が並列実行されている. 9/12=75%Nine instructions are executed intwo cycles. Utilization=9/12=75%

福永 力; Chikara Fukunaga

Page 30: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

30

Predication の概念Concept of Predicate

• 命令に 6 ビットの Predication Register を指定(つまり全部で 64 個の registers; 各 1 ビット)6bit Predication Register specification is added in the instruction. Total 64 registers.

• この Register 値が 1 であれば実行、 0 であれば NOP 、だから命令は以下のような形にIf the value of this register = 1, execute, else =0, then NOP.

(p1) ADD R1,R2,1

• もし p1==1   ADD 命令実行 else NOP if p1==1 ADD else NOP

福永 力; Chikara Fukunaga

Page 31: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

31

Predication example/ の例

福永 力; Chikara Fukunaga

If-else exampleCMP.EQ P1,P2, 10, R5(P1) inst1 (P1) inst2(P1) …(P2) inst3(P2) inst4… …

……If (x==10) c=c+1 ;……

…… CMP.EQ P1, 0, R5(P1) ADD C,1

If example

Page 32: VLIW ( Very Long Instruction Word ) &  マルチスレッドプロセッサ ( Multi-Thread Processor )

32

x86 と Itanium コード比較Code comparison between x86 and Itanium

• x86 code example CMP AX, 0 JE L1 CMP BX,0 JE L1 ADD J, 1 JMP L3L1: CMP CX,0 JE L2 ADD K, 1 JMP L3L2: SUB K, 1L3: ADD I, 1

福永 力; Chikara Fukunaga

• Itanium code example//Compare R1 with 0, if it is true then P=1 and P2=0,

// otherwise P1=0 and P2=1 CMP.EQ P1, P2, 0, R1 (P2) CMP.EQ P1, P3, 0, R2(P3) ADD J,1(P1) CMP.NE P4, P5, 0, R3(P4) ADD K, 1(P5) SUB K, 1 ADD I,1