40
手軽な外付けFPGAアクセラレータによる ソーティングの高速化 2015/03/18 情報処理学会 第77回全国大会 @京都大学吉田キャンパス FPGAとアクセラレータ[3K会場] 発表12+ 質疑応答3臼井 琢真1 吉瀬 謙二2 1 東京工業大学 工学部情報工学科 2 東京工業大学 大学院情報理工学研究科 High-speed Sorting using Portable FPGA Accelerator

High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

Embed Size (px)

Citation preview

Page 1: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

手軽な外付けFPGAアクセラレータによるソーティングの高速化

2015/03/18 情報処理学会第77回全国大会 @京都大学吉田キャンパスFPGAとアクセラレータ[3K会場] 発表12分 + 質疑応答3分

☆臼井 琢真†1 吉瀬 謙二†2

†1 東京工業大学 工学部情報工学科†2東京工業大学 大学院情報理工学研究科

High-speed Sorting using Portable FPGA Accelerator

Page 2: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

発表の流れ

Motivation

FPGA-ホスト間のインターフェース検討

提案するFPGAソーティングアクセラレータ►概要

►Merge Sorter Tree, System Architecture

►実装・検証

評価►評価環境

►アクセラレータの性能評価

結論・今後の課題

1

Page 3: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

発表の流れ

Motivation

FPGA-ホスト間のインターフェース検討

提案するFPGAソーティングアクセラレータ►概要

►Merge Sorter Tree, System Architecture

►実装・検証

評価►評価環境

►アクセラレータの性能評価

結論・今後の課題

2

Page 4: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

FPGAアクセラレータ►特定の処理を低消費電力かつ高速に実行可能

►科学技術計算やデータベース処理など

► IntelやdwangoがFPGAエンジニアを募集

目的: 手軽な外付けFPGAアクセラレータ►様々な環境で使える,持ち運べる

►ホストPCとのデータ送受信のためのインターフェースが重要

►対象アプリ: 32bit要素のソーティング

Motivation

3

Page 5: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

発表の流れ

Motivation

FPGA-ホスト間のインターフェース検討

提案するFPGAソーティングアクセラレータ►概要

►Merge Sorter Tree, System Architecture

►実装・検証

評価►評価環境

►アクセラレータの性能評価

結論・今後の課題

5

Page 6: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

FPGA-ホストPC間のインターフェース比較

USB3.0は,外付けインターフェースの中でも

接続が非常に容易で,様々な環境で使える

PCI Express x1 に迫る高い転送速度►通信速度がボトルネックになりにくい

→USB3.0を選択

6

接続方法 USB3.0 USB2.0 UART Ethernet PCI Express

最高速度(理論値) 5Gbps 480Mbps 数Mbps 1Gbps@GbE

10Gbps@XGbE

8GB/[email protected] x8

1GB/[email protected] x1

内蔵/外付 外付 外付 外付 外付 内蔵

最新PCでの普及率 ○ ○ × ×(XGbE) △

ホットスワップ ○ ○ × ○ ○

バスパワー 900mA,5V 500mA,5V × × 25/75W@x16

Page 7: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

発表の流れ

Motivation

FPGA-ホスト間のインターフェース検討

提案するFPGAソーティングアクセラレータ►概要

►Merge Sorter Tree, System Architecture

►実装・検証

評価►評価環境

►アクセラレータの性能評価

結論・今後の課題

7

Page 8: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

発表の流れ

Motivation

FPGA-ホスト間のインターフェース検討

提案するFPGAソーティングアクセラレータ►概要

►Merge Sorter Tree, System Architecture

►実装・検証

評価►評価環境

►アクセラレータの性能評価

結論・今後の課題

8

Page 9: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

提案するFPGAアクセラレータ

9

持ち運べる

様々な環境で使える USB3.0

Page 10: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

発表の流れ

Motivation

FPGA-ホスト間のインターフェース検討

提案するFPGAソーティングアクセラレータ►概要

►Merge Sorter Tree, System Architecture

►実装・検証

評価►評価環境

►アクセラレータの性能評価

結論・今後の課題

10

Page 11: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

複数のソート済みデータ列を1つにマージするデータパス

図は 4-way Merge Sorter Tree

ソート対象のデータ列が入力数より多い場合は複数回通す必要

Merge Sorter Tree

11参考: A high performance sorting architecture exploiting run-time reconfiguration on fpgas for large problem sorting.

(Dirk Koch and Jim Torresen, FPGA ’11,)

>

>

> > Comparator

Short FIFO

入力レーン=

way

Page 12: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

Merge Sorter Tree

data = {2, 4, 6, 5, 3, 1, 7, 8}

12

2

Memory

>

>

>

4

6

5

3

1

7

8

Unit: ソート済みデータ列

Page 13: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

Merge Sorter Tree

data = {2, 4, 6, 5, 3, 1, 7, 8}

13

Memory

>

>

>

2

6

3

7

8

2

4

6

5

3

1

7

Page 14: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

Merge Sorter Tree

data = {2, 4, 6, 5, 3, 1, 7, 8}

14

Memory

>

>

>

2

6

3

7

4

5

1

83

28

4

5

1

Page 15: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

Merge Sorter Tree

data = {2, 4, 6, 5, 3, 1, 7, 8}

15

Memory

>

>

>

6

7

2

3

7

6 28

4

5

1

8

4

5

1

Page 16: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

Merge Sorter Tree

data = {2, 4, 6, 5, 3, 1, 7, 8}

16

Memory

>

>

>

6

37

38

2

4

5

1

8

4

5

1

Page 17: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

Merge Sorter Tree

data = {2, 4, 6, 5, 3, 1, 7, 8}

17

Memory

>

> 6

7

68

2

3>

4

5

1

8

4

5

1

Page 18: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

Merge Sorter Tree

data = {2, 4, 6, 5, 3, 1, 7, 8}

18

Memory

>

>

>

4

5

1

8

2

3

6

7

Page 19: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

Merge Sorter Tree

data = {2, 4, 6, 5, 3, 1, 7, 8}

19

Memory

>

>

>

1

4

5

8

完全にはソートされておらずもう一度通す必要

Unit

Unit

Unit数は1/[way数]となる

2

3

6

7

Page 20: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

Merge Sorter Tree

data = {2, 4, 6, 5, 3, 1, 7, 8}

20

Memory

>

>

>

1

2

3

4

5

6

7

8

Page 21: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

System Architecture

21

32bit

64bit,

2要素ずつソート

64bit

Page 22: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

System Architecture

22

Page 23: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

発表の流れ

Motivation

FPGA-ホスト間のインターフェース検討

提案するFPGAソーティングアクセラレータ►概要

►Merge Sorter Tree, System Architecture

►実装・検証

評価►評価環境

►アクセラレータの性能評価

結論・今後の課題

23

Page 24: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

特電 Artix-7 評価ボード

24

72mm

50mm

USB3.0 Peripheral

Controller

持ち運べる

Page 25: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

USB3.0の通信速度

25

0.25 3.84

39.1

221

330 354

0.13 2.04 25.1

196

334 355

0

50

100

150

200

250

300

350

400

16 Bytes 256 Bytes 4K Bytes 64K Bytes 1M Bytes 16M Bytes

Ban

dw

idth

[MB

/s]

Data Size

Host PC → FPGA

FPGA → Host PC

公称限界値: 360[MB/s]

今回ソート対象のデータ列は32M要素で128MB限界転送速度達成の見込み

Page 26: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

実装・検証

FPGA

8-way Merge Sorter Treeを実装

Xilinx Artix-7 XC7A100T @ 100MHz

ハードウェア記述言語: Verilog HDL

DRAM Controller: Xilinx Memory Interface

Generator(MIG) 7

Interface Moduleに特電IP(VHDL)を使用

H/W使用量 – Block RAM: 20%, Slice: 18%

検証アプリ

VisualStudio2013にてC言語で開発

OS: Windows 7

26

Page 27: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

27

検証アプリコード概略

01:#define ELM = 32*1024*1024;02:int data[ELM];03:04:int (main){05: init(data); // データ列生成・初期化06:07: start = getTime();08: USBWrite(data,ELM); // Send09: USBRead(data,ELM); // Receive10: end = getTime();11: 12: errchk();13: elapsed_time = end – start;14: display(elapsed_time);15:}

01:#define ELM = 32*1024*1024;02:int data[ELM];03:04:int (main){05: init(data);06:07: start = getTime();08: MergeSort(data,0,ELM-1);09:10: end = getTime();11: 12: errchk();13: elapsed_time = end – start;14: display(elapsed_time);15:}

FPGAアクセラレータにソーティングさせる場合

ホストPC上のみでソーティングを行う場合

Page 28: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

発表の流れ

Motivation

FPGA-ホスト間のインターフェース検討

提案するFPGAソーティングアクセラレータ►概要

►Merge Sorter Tree, System Architecture

►実装・検証

評価►評価環境

►アクセラレータの性能評価

結論・今後の課題

28

Page 29: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

評価

パフォーマンスだけでなく高いPortabilityも評価するため評価環境としてPCを4台用意►USB3.0対応2台,USB2.0対応2台

►デスクトップとラップトップ

対象アプリ: 4バイトint型32M要素のソーティング

各PCにて,以下の二つの場合の実行時間を比較►FPGAアクセラレータにソーティングをオフロード

►ホストPC上のみでマージソート

29

Page 30: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

4種類の評価環境 – Computer A

30

Core i7-3770K

@3.50GHz

16GB DDR3 Memory

Supports USB3.0

High

Performance!

Page 31: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

4種類の評価環境 – Computer B

31Supports USB3.0

Core i3-4010U

@1.70GHz

4GB DDR3 Memory

Portable!

Page 32: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

4種類の評価環境 – Computer C

32

Only supports USB2.0

Core i7-870

@2.93GHz

4GB DDR3 Memory

Page 33: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

4種類の評価環境 – Computer D

33

Core Duo T2400

@1.83GHz

1GB DDR2 Memory

Only supports USB2.0

Page 34: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

0

2

4

6

8

10

12

CPU FPGA CPU FPGA CPU FPGA CPU FPGA

Computer A Computer B Computer C Computer D

Ela

pse

d T

ime [

s]

Data Transfer

Sorting only

USB3.0

USB2.0

評価―int型32M個のソーティング

34

Page 35: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

0

2

4

6

8

10

12

CPU FPGA CPU FPGA CPU FPGA CPU FPGA

Computer A Computer B Computer C Computer D

Ela

pse

d T

ime [

s]

Data Transfer

Sorting only

USB3.0

USB2.0

分析

35

性能向上不可能

通信時間 > CPUにおけるソーティング時間

Page 36: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

0

2

4

6

8

10

12

CPU FPGA CPU FPGA CPU FPGA CPU FPGA

Computer A Computer B Computer C Computer D

Ela

pse

d T

ime [

s]

Data Transfer

Sorting only

USB3.0

USB2.0

分析

36

通信時間大幅減

USB3.0で性能向上

Page 37: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

4.12 3.27 8.67 3.28 0

2

4

6

8

10

CPU FPGA CPU FPGA

Computer A Computer B

Ela

pse

d T

ime [

s]

評価 @USB3.0環境

37

2.64x

Faster1.26x

Faster

Merge Sorter Treeを32-wayに拡張しComputer AのCPU比1.88倍の高速化達成

様々な環境で使える

Page 38: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

発表の流れ

Motivation

FPGA-ホスト間のインターフェース検討

提案するFPGAソーティングアクセラレータ►概要

►Merge Sorter Tree, System Architecture

►実装・検証

評価►評価環境

►アクセラレータの性能評価

結論・今後の課題

38

Page 39: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

結論・今後の課題

結論►手軽な外付けFPGAアクセラレータを提案

◇ホストPCとの接続インターフェースにUSB3.0を採用

►対象アプリ: ソーティング

►USB2.0環境では提案するFPGAアクセラレータを用いても性能が向上しない

►USB3.0環境では性能が向上

◇ラップトップPC比2.60倍

◇デスクトップPC比1.26倍→32-way拡張時1.88倍

今後の課題►より高速なソーティングアクセラレータの実装

►他のアプリケーションの高速化

◇グラフ処理,画像処理,データ圧縮etc…

39

Page 40: High-speed Sorting using Portable FPGA Accelerator (IPSJ 77th National Convention, March 2015)

発表履歴・予定

電子情報通信学会研究会(RECONF) 発表 (2015/01/30)

►「USB3.0接続の手軽で高速なFPGAアクセラレータ」

►臼井 琢真,小林 諒平,吉瀬 謙二

ARC 2015 POSTER SESSION (2015/04/15-17)

► “A Challenge of Portable and High-speed FPGA Accelerator”

►Takuma USUI, Ryohei KOBAYASHI, Kenji KISE

40