20
Reconfigurable Computing Adapting Computational Kernels to Field-Programmable Gate Arrays Craig Ulmer [email protected] December 7, 2005 Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear Security Administration under contract DE-AC04-94AL85000. Adrian Javelo UCLA Craig Ulmer and David Thompson SNL/CA Keith Underwood and K. Scott Hemmert SNL/NM

Reconfigurable Computing Adapting Computational Kernels to Field-Programmable Gate Arrays

  • Upload
    anika

  • View
    50

  • Download
    0

Embed Size (px)

DESCRIPTION

Reconfigurable Computing Adapting Computational Kernels to Field-Programmable Gate Arrays. Craig Ulmer [email protected]. December 7, 2005. Adrian JaveloUCLA Craig Ulmer and David ThompsonSNL/CA Keith Underwood and K. Scott HemmertSNL/NM. - PowerPoint PPT Presentation

Citation preview

Page 1: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

Reconfigurable Computing Adapting Computational Kernels to Field-Programmable Gate Arrays

Craig [email protected]

December 7, 2005

Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear Security Administration under contract DE-AC04-94AL85000.

Adrian Javelo UCLACraig Ulmer and David Thompson SNL/CAKeith Underwood and K. Scott Hemmert SNL/NM

Page 2: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

Outline

• Reconfigurable Computing– LDRD progress update

• Ray-Triangle Intersection Algorithm– Porting computational kernel to hardware

• Automation– Replacing your intern with a Perl script

• Summary

Page 3: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

LDRD Progress Update

Page 4: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

In a nutshell..

• Reconfigurable Computing– Use FPGAs as a means of accelerating simulations– Implement key computations in hardware: soft-hardware

double doX( double *a, int n) {int i;double x;

x=0;for(i=0;i<n;i+=3){

x+= a[i] * a[i+1] + a[i+2];…

}…

return x;}

* +

+

a[i] a[i+1]

Z -1

a[i+2]

Software Hardware Synthesized Hardware

FPGA

CPU

RC Platform

Page 5: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

LDRD Sub-projects

Network Intrusion Detection

NI NI

Malicious PacketPattern Matching

NI NI

Cray XD1

Graphics Transport

FPGAViz App

GigETOE

Chromium

Isosurfacing

MarchingCubes

3D Dataset

Page 6: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

Ray-Triangle Intersection Algorithm

Page 7: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

Overview

• Interested in observing hardware design tradeoffs w/ FPGAs– Only recently has floating-point become practical

• Graphics algorithms often need to find Ray-Triangle intersection– Example: Use to find closest triangle to a point– Photon Mapping

• Adrian Javelo: Summer intern from UCLA– Implement algorithm in hardware

..under realistic assumptions

T

+

Page 8: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

Ray-Triangle Intersection Algorithm

• Moller and Trumbore algorithm (1997)– TUV intersection point

• Modified to remove division– 24 Adds– 26 Multiplies– 4 Compares– 15 Delays– 17 Inputs– 2 Outputs (+4 bits)

Page 9: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

Floating-Point Affects Design

• Ideal Case: Continuous pipeline– Possible with larger FPGAs

• SNL/NM: FP units for FPGAs– Big (~20 DP or ~70 SP in V2P50)– 10-17 stage pipelines– 130-200MHz

• Practical Case: Limited hardware– Assume 5 adders, 6 multipliers, 4 comparators– Reuse units, schedule data flow– Use strip mining to remove latency issue

Page 10: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

Hardware Data-Path

• Build wrapper around an array of FP units

Control

Intermediate Buffering

Input Selection

Inputs

Outputs

Page 11: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

Scheduling: Single Iteration

Adders Multipliers ComparatorsStage A0 A1 A2 A3 A4 M0 M1 M2 M3 M4 M5 C0 C1 C2 c3

0 T1-T0 T1-T0 T1-T0 T2-T0 T2-T0

1 T2-T0 PO-T0 PO-T0 PO-T0

2 PDxS2 PDxS2 PDxS2 PDxS2 PDxS2 PDxS2

3 PDxS2 PDxS2 PDxS2 S2xS0 S2xS0 S2xS0 S2xS0 S2xS0 S2xS0

4 S2xS0 S2xS0 S2xS0

5 S2*C0 S2*C0 S2*C0 PD*C1 PD*C1 PD*C1

6 S2*C0 PD*C1 S0*C0 S0*C0 S0*C0 S1*C1 S1*C1 S1*C1

7 S2*C0 PD*C1 S0*C0 S1*C1

8 S0*C0 S1*C1 U+V

9 T*Dold T*Dold

10 U < O V < O UV>D M0<M1

11 OUT OUT OUT OUT

40% 36%

Page 12: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

Scheduling: Two Iterations

Adders Multipliers ComparatorsStage A0 A1 A2 A3 A4 M0 M1 M2 M3 M4 M5 C0 C1 C2 c3

0 T1-T0 T1-T0 T1-T0 T2-T0 T2-T0 T*Dold T*Dold OUT OUT OUT OUT

1 T2-T0 PO-T0 PO-T0 PO-T0 U < O V < O UV>D MO<M1

2 T1-T0 T1-T0 T1-T0 T2-T0 T2-T0 PDxS2 PDxS2 PDxS2 PDxS2 PDxS2 PDxS2 OUT OUT OUT OUT

3 T2-T0 PO-T0 PO-T0 PO-T0 S2xS0 S2xS0 S2xS0 S2xS0 S2xS0 S2xS0

4 PDxS2 PDxS2 PDxS2 PDxS2 PDxS2 PDxS2 PDxS2 PDxS2 PDxS2

5 S2xS0 S2xS0 S2xS0 S2xS0 S2xS0 S2xS0 S2xS0 S2xS0 S2xS0

6 PDxS2 PDxS2 PDxS2 S2*C0 S2*C0 S2*C0 PD*C1 PD*C1 PD*C1

7 S2*C0 PD*C1 S2xS0 S2xS0 S2xS0 S0*C0 S0*C0 S0*C0 S1*C1 S1*C1 S1*C1

8 S2*C0 PD*C1 S0*C0 S1*C1 S2*C0 S2*C0 S2*C0 PD*C1 PD*C1 PD*C1

9 S0*C0 S1*C1 U+V S2*C0 PD*C1 S0*C0 S0*C0 S0*C0 S1*C1 S1*C1 S1*C1

10 S2*C0 PD*C1 S0*C0 S1*C1 T*Dold T*Dold

11 S0*C0 S1*C1 U+V U < O V < O UV>D M0<M1

80% 72%

Page 13: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

Input Selection Hardware

• Assign operations to units– Each stage: M choose N– Affects input selection hardware

• First-Come-First-Serve– Input ports: 1-7 sources– More sources = More HW– Performance based on worst

• Balancing the Schedule– Ops assigned based on inputs– Input ports: 3-6 sources

+ + x x

Input

Output

Intermediate Buffering

Page 14: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

Buffering Intermediate ValuesBuffer Reuse

Minimize number of buffers 40 Memories, 40 MUXs

+ + x x

Input

Z-1 Z-1 Z-1Z-1

Chaining

Minimize control logic81 Memories, 0 MUXs

+

Z-1

Z-1

+

Z-1

Z-1

x

Z-1

x

Z-1

Z-1

Z-1

Input

Page 15: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

Synthesis Results

• Synthesized three designs for V2P50 FPGA– Memory blocks implemented more compactly than MUXs– Simplified approach works best

Design Build Time V2P50 Area Clock Rate Performance

Buffer Reuse 2 hours 35% 125 MHz 1.04 GFLOPS

Chaining 30 minutes 29% 133 MHz 1.16 GFLOPS

Hybrid 30 minutes 28% 126 MHz 1.05 GFLOPS

Page 16: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

Alternate: Full Pipeline

• Implemented complete pipeline– Operations: 37– Pipeline Stages: 62– In-flight values: 564– FP Utilization:100%

• Virtex II/Pro 50 (V2P50)– 57 % Area, 132 MHz– One day to design – 4 hours to compile– 4.8 GFLOPS

• Opteron: ~1 GFLOPS

Page 17: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

Current Direction: Automation

Page 18: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

Automating the Process

• Considerable amount of design/debug time– Schedule adjustments = redesign hardware

• Perl script– Translate schedule into hardware state machines

• Compiler tools– DFG: Build a dataflow graph from operations– Schedule: Find schedule that minimizes delay and buffers– Map: Assign ops to units, balancing inputs– VHDL: Generate synthesizable hardware

Page 19: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

Example: Resources vs. Performance

• Ray-Triangle Intersect– w/o strip mining

• Vary– Number of FP units– Operations/block

• Tradeoff– Depends on parallelism

12

48

1632

1

2

4

8

16

0

1,000

2,000

3,000

4,000

5,000

6,000

7,000

8,000

9,000

10,000

Cycles for 128 Operations

Operations/blockNumber of Units

Page 20: Reconfigurable Computing  Adapting Computational Kernels to  Field-Programmable Gate Arrays

Concluding Remarks

• Reusing FP units enables FPGAs to process larger kernels– Apply traditional scheduling tricks to increase utilization– Algorithm shape affects performance– Simplicity wins

• Simple DFG tools go a long ways– Easy to adjust parameters, generate hardware– Interested in optimization advice or suggestions