• No results found

Algorithm Partitioning and Scheduling for Adaptive Computers

N/A
N/A
Protected

Academic year: 2020

Share "Algorithm Partitioning and Scheduling for Adaptive Computers"

Copied!
134
0
0

Loading.... (view fulltext now)

Full text

(1)

by

Christopher Cornelius Doss

A dissertation submitted to the Graduate Faculty of

North CarolinaState University

in partialfulllmentof the

requirements forthe Doctorate of Philosophy

Department of

Electrical and Computer Engineering

Raleigh,NC

May 2001

Computer Engineering

Approved By:

Chair, Dr. Clay S.Gloster Member, Dr. Winser E.Alexander

(2)

Doss,ChristopherCornelius. AlgorithmPartitioningandSchedulingfor

Adap-tiveComputers (Under the direction of Dr. Clay S. Gloster Jr. and Dr. Winser E.

Alexander.) Adaptive,orrecongurable,computing hasemerged asaviable

comput-ingalternativefor computationallyintense applications. (Weuse the terms adaptive

and recongurableinterchangeably). Here, anadaptivecomputer isa computing

sys-tem that contains a general purpose processor attached to a programmable logic

device such as a eld programmable gate array (FPGA). These computing systems

combine the exibility of general purpose processors with the speed of application

specic processors. The computer system designer can cater the hardware to a

spe-cic application by modifying the conguration of the FPGAs. The designer can

recongure the FPGAs at some future time for other applications since the FPGAs

donot have a xed structure.

Several recongurable computers have been implementedtodemonstratethe

via-bilityofrecongurableprocessors[1,2,3,4]. Applicationsmappedtotheseprocessors

include patternrecognition in high-energy physics [5], statistical physics [6], and

ge-netic optimization algorithms [7, 8]. In many cases [1, 9, 10], the recongurable

computing implementation provided the highest performance, in terms of execution

speed, published (at the respective time).

To achieve such performance, the application must eectively utilize the

(3)

examine the available hardware resources and modify their application accordingly.

Withrecongurablecomputers,theavailableresourcescanbegeneratedwhenneeded.

While it may seem that this exibility would ease the mapping process, it actually

introduces new problems, such as what components should be allocated, and how

many of each component should be used to generate the best performance. With

conventional hardware components, these questions were not an issue. In addition,

software engineers are generally not adept athardware design [11].

In this dissertation, we present a design methodology for systematically

imple-menting computationally intense applications on recongurable computing systems.

This methodology isbased onconcepts fromcompilertheory to ease automation.

In addition to the design methodology, we present RAS, a tool that implements

a signicantportion ofthe designmethodology. RAScan beconsidered asa module

generation tool for assisting the design process. Given a ow graph representing a

loop nest, RAS allocatesa set of resources, and schedules the nodes of the graph to

the resources. RASalsogenerates anestimateof the amount oftime itwould take if

the design implemented according tothe schedule.

This dissertationalsopresentsresultsof designsproducedby RAS. Multipletests

were performedusingthreecomputationallyintensealgorithms. RASmappedthe

al-gorithmstovecongurationsrepresentingdierentsetsofresourceconstraints. Two

ofthe congurations were basedonactualsystems usedinthe researchdevelopment,

whiletheremainingthreewerehypotheticalsystemsbasedonothercomponents

avail-ableinthemarket. ExperimentalresultsfromRASindicatethatasignicantamount

(4)

Christopher Cornelius Doss was born in Columbus, Ohio, on July 9,1971 to

Calvin Edward Doss and Queenie Lensua Brown. He was preceded by one brother,

Surgret Urania Doss. He attended high school in both Brandon, Florida and

Wies-baden, Germany during the years 1985 to 1989. Upon graduation from high school,

he attended the University of South Florida, where he received his Bachelor of

Sci-ence degree in Computer Engineering in Spring, 1994. He began his graduate work

at North Carolina State University in Fall,1994. He received his Masters of Science

degreeinComputerEngineeringinSpring,1997. Hethenenteredthe Ph.D.program

atNorthCarolinaStateUniversity inFall,1997. Hepresented hisQualifying Review

in Spring,1999, and PreliminaryOrals in Spring2000.

Mr. Doss hasextensive work experienceinthe eld of computer engineering. His

experience includesthe following:

He has worked several times as a teaching assistant for North Carolina State

University,beginninginFall,1994. Hisdutiesincludeddevelopingandgrading

labassignments.

Hehasworked asacomputer programmerfor theNorth CarolinaDepartment

of Transportation from1997 to 1998. His dutiesincluded creatinga database

update system for use by eld technicians.

He worked as a software developer for International Business Machines from

(5)

Administration from 1999 to 2000. His duties included the development of

recongurable computing applications.

He worked asaninstructor atWake Technical Community College from2000

(6)

I would like to thank God for giving me the strength and abilities needed to

successfullycomplete mythesis. WithoutHisstrength,inspiration,and care,I would

not have been able to focus oncompleting this work.

I would also like to thank Dr. Clay Gloster, Jr. for his support throughout my

graduate education and the writings of both my Masters thesis and my doctoral

dissertation. His keen insights, constructive suggestions, and availability have been

greatly appreciated. I alsothank Dr. Winser Alexander for assisting methroughout

mygraduate education. Hehas graciouslygiven meinsightsand commentsbenecial

to my development as a researcher. I would also like to thank the other members of

my committee, Dr. Thomas Conte and Dr. Purush Iyer, who have most generously

oered their advice and help.

IalsothankDr. KevinBowyer,Dr. JoanHolmes,andDr. JoyO'Shieldsfortaking

a special interest in me while obtaining my undergraduate degree. Without their

encouragement, preparation, and assistance, I might not have pursued a graduate

degree.

I would liketoexpressmydeepest appreciationand lovetomyparents,whohave

given me the necessary background, encouragement, and nancial support to make

pursuingthistaskpossible. Ialsothankmybrotherforhislovingguidanceandwords

(7)

List of Figures vii

List of Tables ix

1 Dissertation Overview 1

1.1 Introduction . . . 1

1.2 MajorContributions . . . 3

1.3 Terminology . . . 4

2 An Overview of Recongurable Computing 6 2.1 A HistoricalOverview of Recongurable Computing . . . 7

2.2 Summary of Several Implementations of Applications on Recong-urableComputing Systems . . . 15

2.3 Summaryof DesignMethodologiesforRecongurable Computing Sys-tems . . . 16

2.4 Summary of Tools for Mapping Algorithms to Recongurable Com-putingSystems . . . 20

3 Design Methodology 32 3.1 Overview of the Proposed Design Methodology. . . 32

3.2 The Proposed DesignMethodology . . . 33

4 Overview of Major Components for Lego RC-RAS Module 42 4.1 Flowand Dependence Analysis . . . 42

4.1.1 Control-FlowAnalysis . . . 43

4.1.2 Data-FlowAnalysis . . . 46

4.1.3 Dependence Analysis . . . 46

4.1.4 Dependence Analysisfor Loops . . . 48

4.2 The Lego Compiler . . . 51

4.2.1 RebelCode . . . 51

(8)

4.5 RASTransformationsfor Further Enhancing Speedup forLoopNests 62

5 RAS Implementation 71

5.1 Overview of RAS System . . . 71

5.2 Overview of Resource Allocation and Scheduling . . . 74

5.3 Implementation ofthe RASScheduling Unit . . . 80

5.4 Implementation ofthe RASResource AllocationUnit . . . 85

5.5 Implementation ofthe RASTransformation Unit . . . 86

6 Experimental Setup and Results 87 6.1 Overview of Computing Systems. . . 88

6.2 MatrixMultiplication . . . 91

6.3 FullMulti-gridAlgorithm . . . 102

6.3.1 Red-black Gauss-Seidel Relaxation . . . 102

6.3.2 Residual . . . 108

7 Conclusions and Future Research 114

(9)

2.1 Architecture of a modern FPGA. . . 13

2.2 Schematicof a modern congurablelogic block. . . 13

2.3 Schematicof a modern generalrouting matrix. . . 14

2.4 Schematicof a modern input/outputbuer. . . 14

3.1 Methodology formapping applicationsto R.C. systems. . . 34

3.2 Loopblock representation of inner loops for PNN. . . 38

4.1 Example high-level languageimplementationof vector addition. . . . 44

4.2 Example assembly code implementationof vector addition. . . 44

4.3 Example owchart for vector addition. . . 45

4.4 Samplenested loopand correspondingiteration space. . . 49

4.5 Example programloop. (a) Ccode. (b) Assembly code, without loop controlinstructions.. . . 54

4.6 Datadependence graph for example program. . . 55

4.7 Overlappingloopiterationsforexampleprogram,withoutloopcontrol instructions. . . 56

4.8 Example nestedloopalgorithm: matrix multiplication. . . 63

4.9 Inner k loopin assembly languageformat. . . 64

4.10 Pipelined scheduleof inner k loop. . . 65

4.11 Pipelined scheduleof inner k loopexploiting reuse. . . 66

4.12 Strip-minedinner j loop. . . 67

4.13 Vectorized innerj loop.. . . 68

4.14 Tiled iand innerj loops.. . . 69

4.15 Parallel executionof looptiles.. . . 70

5.1 Overview of RAS system architecture. . . 72

5.2 Data-owgraph of inner k loopfor instructionlevelformat. . . 73

5.3 Resource set forinner k loop. . . 74

(10)

6.3 Secondsegmentofassemblylanguageofinnerloopforrelaxationroutine.105

6.4 Registersused for variables inrelaxation routine. . . 106

6.5 Ccode for calculatingthe residualof a function. . . 108

6.6 Firstsegmentofassemblylanguageofinnerloopforcalculatingresidual.109

6.7 Secondsegmentofassemblylanguageofinnerloopforcalculating

resid-ual. . . 110

(11)

6.1 Matrix multiplication execution times for dierent ordering of loops

using GP1. . . 93

6.2 Matrix multiplication execution times for dierent ordering of loops

using GP2. . . 94

6.3 Matrix multiplication execution times for dierent ordering of loops

using GP3. . . 94

6.4 Estimated matrix multiplication times using regular implementation

for recongurable computing systems. . . 95

6.5 Resource requirements for regular implementation of matrix

multipli-cationon recongurable computing systems. . . 96

6.6 Estimatedspeedup ofR.C. systemsoverGP1 formatrixmultiplication. 97

6.7 Estimatedspeedup ofR.C. systemsoverGP2 formatrixmultiplication. 97

6.8 Estimatedspeedup ofR.C. systemsoverGP3 formatrixmultiplication. 97

6.9 Estimated matrix multiplicationtimes usingreuse implementationfor

recongurable computing systems. . . 98

6.10 Resource requirements for reuse implementation of matrix

multiplica-tion onrecongurable computing systems. . . 99

6.11 Estimated matrix multiplicationtimes forsegmented reuse

implemen-tationfor recongurable computing systems. . . 101

6.12 Resgister le size for segmented reuse implementation of matrix

mul-tiplicationonrecongurable computing systems. . . 101

6.13 Estimated matrix multiplication times using tiled implementation for

recongurable computing systems. . . 101

6.14 ExecutiontimesforperformingGauss-Seidelrelaxationongeneral

pur-pose processors. . . 103

6.15 Estimated execution times for performing Gauss-Seidel relaxation on

recongurable computing systems. . . 105

6.16 Resource requirements for implementation of Gauss-Seidel relaxation

onrecongurable computing systems. . . 106

6.17 Estimated speedup of R.C. systems over GP1 for Gauss-Seidel

(12)

6.19 Estimated speedup of R.C. systems over GP3 for Gauss-Seidel

relax-ation. . . 107

6.20 Execution times for calculating the residual on general purpose

pro-cessors. . . 110

6.21 Estimated execution times for calculating the residual on

recong-urablecomputing systems. . . 111

6.22 Resource requirementsfor implementationof residualalgorithmon

re-congurablecomputing systems. . . 112

6.23 Estimated speedup of R.C. systems over GP1 for residualalgorithm. 112

6.24 Estimated speedup of R.C. systems over GP2 for residualalgorithm. 113

(13)

Dissertation Overview

Thisdissertationpresentsadesignmethodologyformappingcomputationallyintense

regions of an algorithm to recongurable computers, and a tool that automates a

signicant portion of the methodology. Section 1.1 presents an introduction to the

eld. Section 1.2presents the contributions made in this dissertation. Denitions of

terms used inthis dissertation are presented in Section1.3.

1.1 Introduction

Recongurable computers (R.C.) have been shown to perform extremely well with

manycomputationallyintensiveapplications[1,5,6,7,8,9,10]. Thesesystems

com-binetheexibilityofgeneralpurposeprocessorswiththespeedofapplicationspecic

processors. Several recongurable computers have been implementedtodemonstrate

the viability of recongurable processors [1, 2, 3, 4]. Applications mapped to these

processors include pattern recognition in high-energy physics [5], statistical physics

[6], and genetic optimizationalgorithms[7, 8].

This research has shown that recongurable computers present a viable new

op-tion to the computer design paradigm. However, this new option has opened the

door toa methodology that is unfamiliar to most computer designers. These

(14)

Because there are limited tools for implementing high-level languages on R.C.

sys-tems, mappinganapplication to aR.C. isprimarily amanualprocess.

Thismotivatedourresearchgrouptoinvestigatethepotentialfordevelopingatool

forautomatingthisprocess. Whilethereisafairamountofresearchintothe

develop-mentoftoolsthatassistinthe implementationofR.C.applications[3,11,12,13,14],

wedecided toapproachthis researchby rstmappinganapplicationtothe R.C.

sys-teminourresearchlab. Weanticipateddiscoveringpotentialmethodologystepsthat

would beprimecandidatesforautomationwhileimplementingthis candidatedesign.

The completion of this initialcandidate application required several members of

our research group to work for several months to complete a functional

implemen-tation. After successfully mapping the application to the R.C system, our R.C.

im-plementation compared favorably to the general purpose processor implementation.

However, we realized we were using an ad hoc approach for mapping the design to

the R.C. system. We felt subsequent implementations of other applications would

alsohaveanadhoc approachand require several months toobtaingoodresults. We

also felt it would be diÆcult for other members of our research group to duplicate

our results.

Thus, we discovered the need for a design methodology that could be followed

to consistently obtain good results in a reasonable time period. We determined this

methodology should be developed ina mannerthat would facilitate automation,

en-ablingthe development ofatoolfor mappingalgorithmstoR.C. systems. Thus, this

methodology should meet the followinggoals:

Reducedevelopment time for implementing anR.C. application.

Enhance the performance of the R.C. system implementation in comparison

(15)

The eectiveness of this methodology has been demonstrated through the design

ofthreecomputationallyintensivealgorithmsonR.C.systems. Thebasisfor

automa-tion has been developed by automatinga key portion of the design methodology.

Thisdissertationisorganizedasfollows. Thefollowingchapterpresentsanoverview

of tools for mappingalgorithmsto hardware. Chapter 3 presents anoverview of our

design methodology. Chapter 4 presents a discussion of the techniques and concepts

ourtoolisbasedon. WepresenttheimplementationofourtoolinChapter5.

Exper-imentsare presented inChapter 6. The nalchapterpresentsconclusions and future

research.

1.2 Major Contributions

Theobjectiveofthisresearchisthedevelopmentandautomationofadesign

method-ologyfor implementing applications onrecongurable computers. The contributions

of this research are:

1. A design methodology that can be utilized by a novice computer designer

to produce R.C. implementations that are signicantly faster than a general

purpose processorimplementation.

2. A toolthat automates key portionsof the design methodology. This tool can

beconsideredamodulegeneratorforimplementingloopnestsonR.C.systems.

3. Afoundationuponwhichtocontinuethedevelopmentofatoolthatautomates

the entire process for mappingapplications toR.C. systems.

4. The R.C. designs of three widely used computationallyintensive algorithms:

[A.]Matrix multiplication;

(16)

5. The demonstration of the feasibility of using oating point precision in R.C.

systems.

1.3 Terminology

This section denes some importantterms used throughout this dissertation.

Reuse: -Anarray elementwhose value isused (fetched orstored)more than

once ina loop, or isused in multiple iterationsof the loop.

Reuse distance: -Distanceinmemory locationsbetween twomemory

refer-ences.

Spatial reuse: -Two memory uses of nearby memory locations.

Temporal reuse: - Two uses of of the same memory location at dierent

times.

Sequential reuse: -Spatial reuse with distance of one.

Locality: - Memory locationpresent in higher levels of memory hierarchy at

time of reuse.

Spatial locality - Use of two nearby memory locations, with elements in

higherlevelsof memory attime of reuse.

Sequential locality- Spatial locality inwhich the elements have a distance

of one, and are both inhigher levels of memory attime of reuse.

Temporallocality-Reuseofanelementatdierenttimes,withthe element

inhigher levels of memory attime of reuse.

(17)

Stride - 1: -Sequentialreuse.

Dependence: - When a program statement S

1

accesses (reads or writes) a

value that another program statement S

2

accesses (reads or writes). This is

denoted S

1 S

2 .

Flow dependence -When S

1 S

2

, and S

1

sets a value that S

2

uses. This is

sometimes denoted S

1 Æ f S 2 .

Anti-dependence - When S

1 S

2

, and S

2

sets a value that S

1

uses. This is

sometimes denoted S

1 Æ a S 2 .

Outputdependence-WhenS

1 S

2

,andbothsetthevalueofsomevariable.

This issometimes denoted S

1 Æ o S 2 .

Inputdependence-WhenS

1 S

2

,andbothreadthevalueofsomevariable.

This issometimes denoted S

(18)

An Overview of Recongurable

Computing

The advancement of technology has resulted in the computer industry witnessing

the developmentof many computationallyintensive applications. Examples of these

application are from the elds of digital signal processing, encryption, and pattern

matching. As the programs become more complex, digital system designers must

developmoreeÆcientsystemstoensurethattheexecutiontimefortheseapplications

is not excessive.

Inthe past,computerdesignersgenerallyhavehadtwochoicestoimplementtheir

system:

1. Designa system that is exible.

2. Designa system for aspecicpurpose [15].

Flexiblesystems, typicallyincludingageneralpurpose processor,are capable of

per-formingmostcommonfunctionsinanacceptableamountoftime. Becausethedesign

of the system isnot centered arounda single function,or asmallgroup offunctions,

they can be programmed toperform a large variety of applications. Example

appli-cationsexecuted ongeneralpurposeprocessors are: word processors,computer

(19)

consisting of an application specic integrated circuit (ASIC), are usually designed

toperform asmallgroupoffunctions very eÆciently. Because ASICsare designedin

this manner, they are generally very fast at a certain type of application, but

inca-pable of performing a wide variety of applications. For instance, a particular special

purpose system could possibly display graphics quickly, but would be incapable of,

orextremely slowat,performingscientic computations.

The recent advancements in technology, specically with congurable hardware

devices, have given designers a new option when designing a system. With these

recongurable hardware devices, designers can congure the system to perform one

set of tasks, specically for one application, then congure the system to perform a

dierent set of tasks for another application at a later time. The recongurability

provides the ability to execute a large variety of applications. The hardware

pro-vides enhanced performance since it is congured to perform a specic set of tasks.

Thus, recongurable computers provide a happy medium between two disparate

de-sign choices. The potential performance enhancements of R.C. systems has ledto a

signicantamountofresearch inthearea. Thefollowingsectiondiscusses abrief

his-tory of recongurable computing. Section 2.2 discusses some applications that have

beenmappedtoR.C.systems. Section2.3 discussessomemethodologiesformapping

algorithms to R.C. systems. Section 2.4 concludes the chapter with a discussion of

several designautomation tools forR.C. systems.

2.1 A Historical Overview of Recongurable

Com-puting

The complexity of scientic algorithmshas necessitated the need for more advanced

processing techniques. Often, the performance of these applications on typical

(20)

toreduce the executiontime of these algorithms. Thereare three factors that

deter-mine the execution time for acomputer application [16]:

1. The clock frequency.

2. The total number of instructionsexecuted.

3. The average number of clock cycles needed toexecute each instruction.

Themost straightforward methodof decreasingthe executiontimeofanapplication

is to simply increase the clock frequency. However, the highest speed at which an

integrated circuit can operate is usually limited by the technology. Usually,running

anintegratedcircuitataspeed higherthantherateforwhichitisdesigned cancause

problems. For agiven technology,this methodis typically not a viablealternative.

The total number of instructions is based on the underlying algorithm,and

pre-dominantlyindependentofthe hardware itisexecuted on. Thus, computer designers

tend toattempttoreduce theaverage numberof clock cycles needed toexecuteeach

instruction. This can be accomplished by alteringthe architecture of the system to

reduce the number of clock cycles for each instruction, or by performing multiple

instructions per clock cycle.

Computer architects have generally had two choices for addressing the need for

increased performance. The primaryoptionhas beenthe use of the latestgeneration

of general purpose processors due to their exibility and increased clock rate. For

applications that require even more computational power than obtained with

typi-cal processors, the parallelismembedded in the algorithmcan beexploited by using

multi-processorsystems oradvancedgeneralpurpose processors,suchassuper-scalar

and very long instruction word processors. While multi-processor systems can

(21)

The implementation of specialized co-processors, or more generally, special

pur-pose processors, is the secondary option available to system designers. This option

reduces the average number of clock cycles for each instruction. Co-processors and

special purpose systems are developed to perform a small number of functions very

quickly, and provide lower execution time than general purpose processors for these

tasks [16]. Because they are designed inthis manner, they are generally very fastat

acertain class ofapplications, but incapable ofperforming awide variety of

applica-tions.

The concept ofspecializingthearchitecture ofaprocessor whilemaintaining

ex-ibility rst appeared in the early 1970's, with researchers investigatingthe potential

foraugmentingthemicrocodeofprocessorsforagivenapplication. Here,theideawas

to modify the instruction set at compile time to reduce the traÆc to main memory

[17]. Theinstructionsetwasmodieddynamicallytoallowtheusageofverycomplex

instructions. These complex instructions reduced the number of instruction fetches

and decodes, thusreducing the number of mainmemory accesses [17]. Since, atthat

time, the access to main memory was an order of magnitude slower than microcode

memory,itwasenvisioned thatthesecomplex, multi-cycleinstructionswould leadto

enhanced performance.

One implementation of an application specic instruction was the polynomial

evaluationinstructionforthe DECVAX.However, itisverydiÆcultforcompilersto

recognize when to use such a complex instruction in high-level languages. Research

at IBM showed that only asmall subset of these complex instructions were actually

being used in practice [18]. As a result, in the 1980's, computer architects focused

on reducing the number of instructions available [16]. This led to the introduction

of the Reduced Instruction Set Computer (RISC). This reduction in the number of

(22)

The concept of combiningthe speed of special purpose processors with the

exi-bility of general purpose processors has been revisited with the use of recongurable

computing systems [15]. We dene recongurable computing systems as computer

systems containing at least one hardware component that is designed for its

func-tionality to be modied by the end user (we do not include storage elements here).

Operations implemented on R.C. systems can be viewed as complex instructions.

However, instead of simply reducing interaction with main memory, these

instruc-tions take advantage of the inherent parallelism of the underlying algorithm. This

enablesa signicantperformance advantage overa typicalgeneralpurpose processor

implementation. Because the structure of the recongurable component isnot xed,

itcanbecustomizedforotherapplications. Thisallowsthecomponenttobeexible,

a quality not availableinspecial purpose processors.

The key to recongurable computing systems is the capability of the

recong-urable componentto implementany given logic function. The reasonfor this is that

the logical functions, and the interconnections to them, are not xed. This is in

contrastto mosthardware used incomputing,whichhavexed logical functionsand

interconnections.

Although the current interest in recongurable computing is only a few years

old, recongurable computing components were rst proposed over 30 years ago by

GeraldEstrin ofUCLA [19]. Heproposedcouplinga xedgeneral purpose processor

with a congurable logic component. Unfortunately for Estrin, the technology for

thesecomponentswasnot availableatthe time. Interestinthismethodologydid not

surface until after the introduction of more advanced logical devices. These devices

includesuch components as:

Programmable Array Logic (PAL 1

) - A programmable logic device,

de-signed to implement two level sum-of-product (SOP) functions ( where the

(23)

rst level consistsof AND gates and the second level consistsof OR gates)in

which the rst logic level is a programmable array the second logic level is a

xed array.

Programmable Logic Array (PLA) - A programmable logic device

de-signedtoimplementSOPfunctionsinwhichbothlogiclevelsareprogrammable

arrays.

Complex Programmable Logic Device (CPLD) - A device that

con-tains a number of PLA or PAL functions sharing a common programmable

interconnection matrix.

Field Programmable Gate Array-Anarrayof functionallycomplete

(ca-pable of implementing any logic combinationof its input) logic elements

con-nectedvia interconnection network.

DynamicallyProgrammable Gate Arrays-AFPGA with on-chip

mem-oryfor storing congurations.

While there are many devices that qualify for components in a recongurable

system, most are not seen in typical designs. As PALs and PLAs implement

two-level logic, they are not exible enough to implement the functions recongurable

systems are foreseen to be used for[2, 9]. FPGAs, on the otherhand, are capable of

implementing any synchronous digitalcircuit [9].

When rst introduced, the FPGA was typically viewed as a programmable gate

array or programmable logic device. However, their method of conguration, with

the use of volatile memory cells, was viewed as a liability. During the late 1980's

and early 1990's, research groups began to realize this conguration method could

(24)

easily. Whileearly FPGAs required several seconds for conguration, newer FPGAs

can be congured in less than a millisecond [15]. This, along with their exibility,

has ledto the widespread use of FPGAs in computing systems [2, 3, 16, 20,21]. In

fact, FPGAs are the most frequently used component for recongurable computing

systems [22, 23]. Therefore, inthis dissertation,we focus our attention onFPGAs.

The key to recongurable computing systems is the capability of the FPGA to

implementany given logic function. The reasonfor this is that the logicalfunctions,

andthe interconnections tothem, arenot xed. Thisisincontrasttomosthardware

usedincomputing,whichhavexedlogicalfunctionsandinterconnections. AnFPGA

consistsofanarrayoflogicblocksconnectedbyaprogrammablenetwork. TheFPGA

can be programmed atthree levels [24]:

1. the logic block level,

2. the interconnection level,

3. the input/outputlevel.

Figure 2.1 from [25] shows the architecture of a Xilinx Virtex chip. It consists of

an array of congurable logic blocks (CLBs), surrounded by a programmable

inter-connection (VersaRing) to the input/output buers (IOBs). It also contains 4K-bit

block memories (BRAMs) and distributed clock signals (DLLs).

Programming at the logic block level consists of specifying the relationship

be-tweentheinputsofalogicblockanditsoutput. Anexamplewouldbethespecication

thattheoutputistheadditionoftheinputs. Figure2.2showstheschematicofa

con-gurable logic block (CLB). Each CLB contains two 4-input look-up tables (LUT).

The LUTs are function generators, capable of implementing any logical function of

(25)

Figure2.1: Architecture of a modern FPGA.

Figure 2.2: Schematicof a modern congurablelogic block.

Programmingattheinterconnectionlevelconsistsofspecifyingwhichlogicblocks

are connected, and in what manner. An example would be the connection of 16

logic blocks, each congured to perform the ADD operation. The overall structure

(26)

Figure2.3: Schematic of amodern general routingmatrix.

Figure 2.4: Schematicof a modern input/outputbuer.

interconnection matrix. Horizontal and vertical resources can be connected via the

GRM.CLBs are alsoconnected via the GRM.

Programming at the input/output level consists of specifying how the circuit on

theFPGAinteractswiththeoutsideworld. Theinput/outputpadsontheFPGAcan

beconguredtolinktothecircuitimplementedontheFPGAinany waydesired. An

(27)

16 other pads to the output of the 16-bit ADD circuit. Figure 2.4 from [25] shows

the structure of a modern input/output buer. The IOB contains storage elements

that can act as ip-ops or latches. Control signals are used to enable the storage

elements.

The recongurability ofFPGAshaslimitedthe device'sabilitytostoredesignsas

large and/or complex as its counterparts are. For example, while a special purpose

system could perform all the functions necessary to manipulate graphics, an FPGA

may onlybe capableof storing 50% of the functions (atone time). In addition, the

use oflogic blockshas resulted inalowerclock rate. However, newerFPGAs contain

the equivalentofseveral millionlogic gates,and supportclockrates of over 300MHz.

In addition, they can take advantage of the fact that a large portion of execution

time is spent in a smallportion of the applicationcode [26]. Thus, the kernel of the

applicationcouldbecodedontothe FPGA,resultinginalargeimpactonthe overall

execution time for the application. Also, the FPGA could be congured to perform

other functionsas needed.

2.2 Summary of Several Implementations of

Ap-plications on Recongurable Computing

Sys-tems

Several research groupshave investigated theperformance thatcan be achieved with

recongurable systems [1, 9, 27, 28, 29]. An early example of a recongurable

pro-cessor is the Splash machine, presented in [1]. This processor, consisting of a linear

array of Xilinx 3000 FPGAs, was used to implementa geneticstring matching

algo-rithm. This processorwascongured toexecute the algorithm200 timesfaster than

the speed achievable ona supercomputer [30].

(28)

memory (PAM) because it is attached to the main bus of the host computer, and is

read and writtenmuch likeaRAM. Several scientic applications were implemented

onthis system. One such application was long integer multiplication [31], where the

product AB +S is calculated. Here, A is an n-bit long multiplier (up to 2000 ),

B isan arbitrarysized multiplicand,and S isthe summand. Their performance was

16 times faster than the same application on a Cray II and Cyber 170/750 [32]. In

fact,theirimplementationwasfasterthanallpreviouslypublished benchmarks. RSA

Cryptography [33]isanother application inwhich theirsystem wasfaster than those

previously published [34]. Recongurable systemswere shown toprovidethe highest

performance available for other applications as well, including: modular

multiplica-tion [35], statistical physics [6, 36], region detection and labeling [37], and hidden

Markov modeling[38].

With many of the implementations, there were no guidelines to follow for the

implementation. Thus, future implementationswouldpossibly not leadtosignicant

performance enhancement. Thus, several research groups have developed

environ-mentsandmethodologiesthatfacilitatethemappingofalgorithmstoarecongurable

computing system [39, 40, 41, 42]. The following sectiondiscusses these

methodolo-gies.

2.3 Summary of Design Methodologies for

Recon-gurable Computing Systems

In this section, wediscuss several design methodologiesfor implementing algorithms

on R.C. systems. The goalof these methodologies is tohave a standard method for

obtaininggoodresults from the mapping of computationallyintense applicationson

R.C. systems.

(29)

com-Development Environment (RCADE) is to facilitate novice and expert R.C. system

designers to implement R.C. applications that provide enhanced performance over a

software solution. RCADE includes a set of tools and a library of components that

can be used by the designer.

RCADE designers represent algorithms with the Algorithm Description Format

(ADF),comprisedof DesignUnits (DU).ADUrepresentsasingle graph. Thenodes

containinformationaboutthecomponentselectedforimplementingagivenoperation

in the algorithm. This information includes the number of input and output ports.

The edges in the graphrepresent connections between ports.

RCADE has/will have several analysis tools to aid in the development process.

These toolsinclude:

Precision Analysis Tool:Atooltohelpthe usertospecifythe precisionfor

the algorithm.

Throughput Analysis Tool: Atoolthat examinesthe dataproductionand

consumptionratesof thecomponents,andreduces the numberofcomponents

accordingly.

Pipeline Balancing Tool:Atoolthatexaminesalternatepathsofthedesign

that merge to a common node, and inserts FIFOs in the path with the least

delayto ensure data synchronization.

Placement Tool: A toolfor placingthe components.

WithRCADE,thecreationofanR.C.applicationbeginswiththeuserrst

speci-fyingthe designasagraph. Thenodesof thisgraphare abstractoperationsfromthe

(30)

component selectorthen binds the abstract operations tocomponentsin the

compo-nentlibrary. Theplacementtoolisthenusedtopartitionthe componentsamongthe

availabledevices. The code generator then synthesizes the application.

GajjalaPurna et. al. [40] present a temporal partitioning design methodology,

wheretasksareseparatedintosubtasksthatareexecutedatdierentintervalsintime.

Here, applications are analyzed for their spatial exibilities, tasks that can execute

simultaneously, and temporal constraints, the amount of freedom for specifying the

time interval a task must execute. This examination results in temporal partitions,

whicheachrepresent acongurationof the FPGA. The temporalconstraints specify

theorderinwhichthecongurationsareused. Thespatialexibilityofeachpartition

is determinedby the parallelismavailable between dierent tasks.

The design process begins with aninput designspecicationthat is preprocessed

into a data ow graph model. Each node of the data ow graph symbolizes a

func-tional block of the application. Edges between the nodes represent the ow of data.

Eachnode isthenassignedanASAP level[43]. TheASAPlevelrepresents thedepth

of a node with respect to the design inputs. The ASAP level indicatesthe available

parallelism. Nodes with the same ASAP levelcan execute inparallel. The nodes are

then partitioned using amethodology similarto that used for multiprocessors [44].

Dawoodet. al. present theirdesignmethodologyfor implementingaFIRlterin

[41]. This methodology focused onaspecicimplementation,which isin contrast to

other methodologies [40, 45].

The design process began by rst examining the available factors, such as the

lter coeÆcients and the required performance. The next step was todetermine the

ltercoeÆcientsusingMatlab. They thenused thefollowingdesigncycle toproduce

(31)

2. Design Implementation: Place and route tools are used to convert the

netlistis into abitstream, or FPGA congurationle.

3. Design Verication:The designis simulatedtoensureproperfunctionality.

4. FPGA Conguration: The FPGA is congured by loading the bitstream

ontothe FPGA.

ShrivastavaandJainpresentadesignmethodologyformappingR.C.applications

to a rapid prototyping system in [42]. This system is a coarse grain recongurable

platform,with onlyasmallnumberof computationalcells. Their system isbasedon

two exible cells:

1. MA PLUS: An enhanced multiply-add cell, capable of performing several

functions,including:

The multiplicationof two values, Z =AB.

The additionorsubtraction of twovalues, Z =CD.

The multiplicationand additionof three values, Z =AB+C.

The multiplication and accumulation of two values with a third, Z =

Z+AB.

2. UNL: A universal nonlinear cell, capable of the performing several complex

functions, including trigonometric functions, inverse operations, and

square-root.

The design process involves a two step process. The rst step involves selecting

several MA PLUS and UNL cells for the corresponding algorithm. The second step

involves the interconnection of the cells toperform parallelprocessing.

(32)

imple-of experience to properly use these methodologies. (This is in contrast to our

de-signmethodology,whichremainsconstantregardlessofthe application.) Inaddition,

some are fairly complex to utilize. As a result, a vast amount of research is being

performed todesign toolsthat willassist inthe design process [3,11, 12,13, 14]. In

order for these toolstogain wide acceptance with computer designers, they must be

capableofassistingthedesignerinmappingalgorithmsintohardware. Thecomputer

designers should be able to implement their algorithm in some high-level hardware

description language similar to Verilog or VHDL, and have the tools perform the

steps involved toproduce a working implementation.

Of course,requiringahardware descriptionasinputlimitstheuse ofthe software

tools to those adept in computer design. For the software to cater to the scientic

community atlarge,the software shouldallowthe user toimplementtheir algorithm

in a computer language more familiar to them, such as C, C++, or Java. The

acceptance ofa high-level languageinputwould allowscientists who are not familiar

with computer design to express their algorithms in a language they are familiar

with. The software tool should then be capable of mapping these algorithms onto

the recongurable computer, and executing the algorithmwith a signicant gain in

performance. The following sectionpresents several toolsthat address this issue.

2.4 Summary of Tools for Mapping Algorithms to

Recongurable Computing Systems

Several recongurable computing systems utilize the FPGA as a high-performance

substitute for standard computers or supercomputers [1, 9, 27, 28, 29]. The results

indicate that the recongurable computing system provides very goodperformance.

As the use of recongurable computing systems grows, many new applications will

(33)

these applications will largely be software programmers who are not familiar with

hardware design. These programmers are used towriting their applications in

high-levellanguagessuchasC,C++,orJava. Theseprogrammerswouldwanttocontinue

using these languages, while taking advantage of the fullpower ofthe recongurable

system. Therefore, software tools must be capable of mapping applications written

inahigh-levellanguage toanimplementationinthetarget recongurablecomputing

system.

Several research groups have written tools that transform programs written in

high-level languages into a hardware implementation [46, 47, 48, 49, 50]. The

sup-portedlanguagesincludeC[3,12,13,14,16,20,47,51], C++[48],Java[52,53],Ada

[54],Occam[55,56],SmallTalk[57],Assembly[58,59], andvarioushardware

descrip-tion languages [60, 61]. Typically, these tools accept some subset of the supported

languageasinput. Datacomputationsaretranslatedintohardware operations.

Con-trolow isrecreated with the use of state machines, latches, and multiplexors.

In this section, we present an overview of several tools that map applications

written inC [3, 12, 13, 14, 16, 20, 47, 51, 62] or Java [53] to recongurable

comput-ing systems. We also include an overview of a system that maps C programs to a

nonprogrammablehardware accelerator[?]. Wefocus mainlyonthe compilationand

mapping techniques used in the tools. These tools were chosen because of the wide

use of the languages, and because our future research will likely map C applications

to recongurable hardware. Also, some of our development tools focus on remote

congurationviathe internet. The JavaDevelopmentKithas a set ofclasses toease

the communication between objects over the internet. Therefore, we have included

toolsthat map Java torecongurable hardware.

Thesepapersrepresentawiderangeofrecongurableplatforms. Toolsthataccept

(34)

FPGAs; the Transmogrier C compiler [20], a tool that targets a specic FPGA

family; RECON [16], a system consisting of a workstation connected to a FPGA;

CoDe-X [62], a tool that targets a recongurable ALU; and tools that map C to

multiple FPGAs [14, 47]. JVX [53] is a rapid prototyping system that maps Javato

FPGAs.

PRISM-I(ProcessorRecongurationthroughInstructionSetMetamorphosis),the

toolpresentedin[13],mapsprograms writteninCtoahostprocessorandanFPGA.

The tool is a conguration compiler that rst performs function identication and

extraction. Thisprocessidentiessegmentsoftheinputprogramaseithercandidates

forhardwareimplementationorsoftwareimplementationbyimposingaminimum

res-olutionfunctionsubroutineonpotentialsegments. Thehardwarecandidatesarethen

transformedintoahardwaredescriptioncapableofreconguringthehardwaredevice.

The software candidates are redened to access the newly synthesized functions.

The synthesis process rst veries the integrity of the input by passing the C

hardware candidate(s) through cpp and lint, two standard Unix tools. Next, the

parserconverts theinputintoaninternalrepresentation,andcreatessoftware

access-denitionsthatwilllinktotherecongurablehardware. Theinternalrepresentationis

thenusedbytheparsertobuildadata-owgraph(DFG).NodesintheDFGarethen

used toinstantiatehardware componentsfromalibraryof structures. Optimizations

are then performedto minimizethe hardware image.

After the generation of the hardware image, the software candidates are

com-bined withthe access denitionstocreate anew programspecication. Also,library

functionsthat loadand initializetheassociated hardware imageare insertedintothe

program. The new programis compiled toproduce the nal executable. When ran,

the programloads and initializesthe hardware image(s)automatically.

(35)

a Sun Sparc workstation. However, since PRISM is a proof-of-concept system, it

has several limitations, including: no global variable support; input arguments and

returnvalues are limitedto32-bits;the exitcondition forloops must beindependent

ofinput arguments;nosupport foroating-pointoperations;nosupportfor do-while

orswitch-case constructs.

Wazlowskiet. al. presentPRISM-II, anenhancementtoPRISM-I,in[3]and [12].

The main dierences between PRISM-I and II are the front-end and the number of

restrictionsontheinputsourceprogram. PRISM-Iuses cppandlintasthefront-end.

PRISM-II uses the parsing and optimization stages of the GNU C compiler (GCC)

as the front-end of the conguration compiler. While PRISM-I requires for loops to

have axed loopcount and doesnot allowswitch-case statements, PRISM-II allows

for loops with variableloopcount as wellas switch-case constructs.

InPRISM-II,theinputistransformedintoacontrolowgraph(CFG),whereeach

noderepresentsabasicblock. TheCFGisthentransformedintoanoperatornetwork,

a directed graph where the nodes represent operations,and edges represent the ow

of values. An initial controller is then developed from the CFG. Each basic block

represents a dierent state in the CFG. The controller is then optimized. Finally,

the operator network and controller are translated into a netlist for placement and

routing.

PRISM-IIhas several limitations: itdoesnotsupportmemoryaddressreferences;

it does not support arrays, a structure utilized heavily in computationally intense

applications; it does not support oating point operations; it does not account for

resource constraints while developing the operator network.

The compiler presented in [16] compiles C to RECON, a system consisting of a

SunSparcStationhostand arecongurable co-processor. Here,agatearray compiler

(36)

thenperformsanextensive analysistoextractthe maximalamountof parallelization

inherent in the source function. The compiler uses this information to produce the

netlist.

RECON extracts parallelism from a program by performing data dependency

analysis on the input function. This approach keeps a list of variables in a table.

Information is stored in the table when a variable is assigned. When the variable is

encountered,itsstatusischecked byretrievingitscorrespondingdatafromthetable.

This data indicates how the current statement depends on other statements. The

compilerthen classies the statements into sequences of blocks where allstatements

can be executed concurrently.

Eachblockcomprises astate inanasynchronous state machine (ASM).The

com-piler then converts the ASM into hardware logic by constructing a state transition

table. This transition table contains the current state, next state, and condition for

transition. The compileruses combinationallogic to construct the state controller.

ThecompilerthenextractstheoperationsintheASMandndsthecorresponding

logic gate/macro in the Xilinx database. The macros, along with the appropriate

interconnects, are written to a netlist le. Placement and routing tools ensure the

design willton the recongurable system.

The results indicatethat the RECON implementation of an 8-bit multiplication

program provides substantial speedup over the SparcStation implementation.

How-ever, the RECON compileraccepts only asubset of the Clanguageas input.

Multi-plication,division, and modulus operationsare not supported.

Galloway presents a new language, Transmogrier C, and its compiler in [20].

TransmogrierCissimilartoregularC,withaminimumnumberofextensions. Ithas

integervariables,constants,andexpressions,aswellasifstatements,whileloops,and

(37)

and busport function calls associate C variables inside the program with the input

and output signalsat the periphery of the nal circuit.

The TransmogrierCcompilermaps TransmogrierCtothe Xilinx4000 FPGA.

The compiler uses lex and yacc, standard UNIX tools, to perform the lexical and

semantic checking. It makes two passeson the inputprogram. During the rst pass,

it creates a state machine and creates combinational expressions that represent the

values of each identier ineach state. Duringthe second pass, it performs

optimiza-tions onthe circuitand produces the nal netlist. The extensions to the C language

aidin the translation process.

Thecompilercreatesasequentialstatemachineduringcompilation. Thecompiler

keeps track of which state corresponds to the code being compiled. The compiler

attempts to pack as many assignment statements and if statements as possible into

thecurrentstate. Assignmentstatementsandbooleanexpressionsinifstatementsare

evaluatedascombinationallogicexpressions. Duringprogramexecution, theoutputs

of the combinational logic expressions are stored in ip ops which share a common

clock. Execution of such constructs as while loops and function calls require states

to determine which portion of the program is executing. The compiler creates two

statesfor whileloops: onefor thetop ofthe whileloop,indicatingthetest succeeded

and the loop is to be executed; and one for the exit of the while loop, indicating

the loop test failed. The compiler creates complete state machines for functions.

These state machinesrequire at least two states, the initialstate and the nal state.

During program execution, the program enters the initialstate when the caller sets

the function's initialstate to true. The programenters the nal state, known to the

caller, when the function isnished.

Transmogrier C is easier for a C programmer to learn than traditional

(38)

the nal circuit. However, the language severely limits the programmer's options.

It forbids multiplication, division, pointers, arrays, data structures, and the use of

recursion. Also, itdoes not allowoating point operations.

Clark and Hutchings present the programmingenvironment for DISC ( dynamic

instruction set computer )in [51]. This environmentconsists of anANSI-C compiler

and a retargetableassembler. (Italsohas adebugger whichwe donot discuss here).

The compilersupports allconstructs ofC, aswellascustomhardware capabilitiesof

FPGAs.

The programmingenvironment uses the lcc[63]front-endtoparse the input

pro-gram,performoptimizations,andproduceintermediatecode. The modiedlcc

back-endproducescodefortheDISCprocessor[2]. Theback-endusesasetofbase

instruc-tions, stack protocols, register conventions, and other mnemonics that describe the

processor. Usingtheserules,theback-endtransformstheintermediatecodeproduced

by the front-end intoassembly code.

The programmingenvironment uses dasm, a retargetable assembler, to assemble

the code produced by the lcc back-end. dasm accepts a header leand an assembly

code le. The header le fully species the target machine, including word length,

instruction mnemonics, and bitplacementfor each instruction.

The programming environment supports the entire ANSI-C language. However,

the tool does not actually map Cto hardware. Instead, the user must rst partition

the algorithm into hardware and software sections. Next, the user must design the

actual hardware modules that willbe mapped to the recongurable logic. The user

then rewrites the software touse the hardware modules.

Petersonet. al. [14]proposeanarchitecture independenttoolthattranslates

pro-gramswritteninCtoa data-owrepresentation. Italsoschedulesandpartitionsthe

(39)

ofthetoolallowsittotargetawidevarietyofcomputingplatforms. Theuserspecies

the target by modifying alibrary le that describes the targetCCM architecture.

Thecompileraccepts asinputthesourceprogramandaspecicationofthetarget

architecture of the FPGA processor. The compiler supports the entire ANSI-C

lan-guage. The architecture specication describes the organization of the FPGA-based

CCM.

Petersonuses the retargetable Ccompiler lcc[63]as the basis for their compiler.

The lcccompileris divided intoa front-end and a back-end. The front-end performs

lexical and syntactic analysis and produces directed acyclic graphs (DAG).

Opti-mizationsare performedwhilethe DAGsare being generated. The back-end uses the

DAGs produced by the front-end to generate target-specic code. Forthis research,

the targeted code is GDL (Graph Description Language), a language that describes

data-ow graphs.

After the original programis translated into GDL, the data-owgraphs are

par-titionedand scheduled tothe FPGAarchitecture. The tooluses simulatedannealing

[64] to provide an optimal scheduling and partitioning of the data-ow graphs. A

PERL script then translates the schedules intoVHDL code for synthesis.

As mentioned before, the compiler supports the entire ANSI-C language, and is

capable of targeting many FPGA architectures. Also, the compiler supports

multi-FPGA platform. It also generates optimal partitionsand schedules of the data-ow

graphs. Unfortunately, this toolhas not been implemented.

A major goalof the Program-In-Chip-Out(PICO) system [65, 66]is the

automa-tion of the design of nonprogrammable hardware accelerators (NPA). Schreiber et.

al. present the NPA compiler in [66]. The system accepts C as input, and outputs

VHDL code for an array of very-long instruction word (VLIW) processors. Included

(40)

Theuserprovidesthesystemwithaloopnest,aswellasarangeofarchitecturesto

explore. TheNPAcompilerthenperformsseveralanalyses,inwhichthecompilercan

determine any owdependences, as well as possible iterationspace transformations.

The compilerthen performs on the loopbody, includingreduction in bit widths for

the operands. The compiler then binds operationsto the availableassets of the

pro-cessor. The compiler nishes by producing and interconnecting multiple processors,

and outputting the corresponding VHDLcode and time estimates.

An important disadvantage of the PICO system is the fact that the user must

supply the systemwith aset of potentialarchitectures. Engineers andscientists that

are not adept at computer architecture design may not be able tosupply this input.

Yamauchi et. al. present the architecture and compiler for the recongurable

massively parallelSea of Processors (SOP)system. The mappingprocess consists of

two stages. The toolcompilesthe inputprogramduringtherst stage,and performs

placementand routingduring the secondstage.

TheSOPcompilersupportsalanguagesimilartoordinaryC,withafewextensions

and restrictions. It analyzes the input program, generates the hardware netlist, and

partitionsthe netlist intosegments suitablefor mappingontothe FPGA. It extracts

theparallelisminherentintheapplicationwhileanalyzingtheprogram. Thecompiler

regardsvariablesasnets,and functionsand operationsas nodes. Itexpandsfunction

calls according to the controldata-ow.

The compiler generates data-paths and control circuits for loops. It generates

registersforvariables. Variablesinvolvedinloopsare `imported'ifthey are inherited

from outside the loop. They are `assigned' if they are assigned within the loop. A

token synchronizer at the top of the loop waits for the arrival of tokens, or values

of variables. The arrival of tokens triggers the condition circuit derived from the

(41)

operations. When the condition circuitbecomesfalse, the circuitissues atoken that

activates the circuitry afterthe loop.

The compiler produces condition circuits for if statements in a similar fashion.

Again, variablesinvolved inconditionalstatements are classiedaseither`imported'

or `assigned'. When the condition circuit becomes true, the true block circuitry is

activated. When the condition circuit becomes false, the circuitry following the if

block is activated.

The compilerexploits several levels ofparallelismusing the data-ow

representa-tion ofthe circuit. It exploits inter-block parallelismin loops andif statementswhen

those blocks have nodata dependency.

ResultsindicatethattheSOPcompilercanachieveasignicantamountofspeedup

compared to the MIPS R4400, up to 4.5 times. However, the compilerneeds

exten-sions to the Clanguage. In addition,there are restrictions onthe program's input.

Hartensteinet. al. presentCoDe-X,aframeworkforschedulingdataandtaskson

anXputerin[62]. TwopartitioninglevelsandaGNUCcompilercomprisethe

CoDe-X system. Data sequencers and a recongurable ALU array comprise the hardware.

Here, we discuss the partitioners and schedulers. The reader is referred to [62] for

details onthe hardware.

The rst level partitioner accepts X-C, a dialect of C, as input and produces a

software image and a hardware image. The software image is input to the GNU

C compiler. The software image consists of host tasks, dynamic structures, and

operating system calls. The second level partitioner accepts the hardware image as

input and produces sequential code for the data sequencer, and structural code for

the recongurable ALU.

DataandtaskschedulersintheCoDe-Xframeworktargetthedata-drivenXputer.

(42)

foralltasksintheprogram. TheTEGalsorepresentsalldatadependencies.

Concur-rency update pointsdivide the TEG into sequential synchronization time steps with

parallel tasks in each step. CoDe-X then processes the rst time step of the TEG

by assigning all tasks that can be executed in parallel to dierent Xputer modules.

CoDe-Xensures there arenot more tasksthanavailableXputermodules. Forthe

re-mainingtimesteps,CoDe-Xconsiders onlythe tasksthatbegin inthecorresponding

time step.

Macketanz and Karl present the JVX (Java, VHDL, Xilinx) rapid prototyping

systemin[53]. TheJVXsystemconsistsofacompiler,interpreter,andrecongurable

hardwaredevice. ThecompilergeneratesVHDLcodefromaJavainputprogram. The

interpreter executes Javabyte-code and triggersthe hardware device. The hardware

consists of a Xilinx FPGA board connected via PCI bus to a host processor. Here,

we discuss the compilation method. The reader is referred to [53] for details of the

interpreter and hardware.

The compilationprocess consistsofthree phases: inputparsing,grammar

match-ing, and byte-code and VHDL generation. Java functions, expressions, and control

structures are translated into VHDL state machines. Expressions are partitioned

into their corresponding atomic parts. ( For example, the assignment expression

a =b+cd would be partitioned into a multiply, addition, and assignment. ) The

compiler translates all atomic parts into individual states. The parsing grammatics

enforce propermathematical precedence rules. The compilerproduces similar states

for conditional expressions in if statements and loops. The result is evaluated at

runtime todetermine the next state.

An important disadvantage of the JVX system is the eliminationof much of the

object-oriented nature of the Java program. However, the JVX system is still in

(43)

developing the current implementation include generating parallel VHDL processes

for every independent subexpression, and generating a high-level VHDL behavioral

(44)

Design Methodology

3.1 Overview of the Proposed Design

Methodol-ogy

One ofthe goalsof this researchistodevelop astep-by-step process that reduces the

time required for mappingan application toan R.C. system, and todevelop a

foun-dation upon which to build a compiler that is capableof automating the process of

mapping software applications to a recongurable computer. These goals have been

addressedbydevelopingamethodologyformappingalgorithmstoR.C.systems, and

automatingakeyportionofit. Inthisdissertation,thevalidityofthismethodologyis

veried by applying the design methodology to several computationally intensive

al-gorithmsand developingthecorrelationbetween thestepsinthe designmethodology

and existing compilertechniques.

The design methodology we have developed is for implementing designs ona

re-congurablecomputerarchitecture,whichconsistsofageneralpurposeprocessor

con-nectedtoaFPGAboard. Themethodologyassumesthattheapplicationhasbeen

de-scribedusing Rebel,aformatsimilartotypicalassembly languagecode. This format

canbeobtainedfromCcode usingseveraltoolsreadilyavailableintheLEGOsystem

developed by theTinkerGroupatNorth CarolinaStateUniversity.The methodology

(45)

library specicationforeachmoduleincludes: thefunction the moduleperforms, the

number ofcycles requiredtocomplete the function,the numberof inputs,amountof

area, etc. The functions available inthe library includeadders, multipliers,dividers,

and comparators. The performance goal of our research is an implementation that

is signicantly faster than a general purpose processor implementation of the same

application.

Since we want this methodology tobe incorporated intoa future compiler,all of

the steps of the process must either use techniques currently available in traditional

compilers or can be implemented in software and integrated into the nal system.

We have automated several key steps of the methodology. We have also dened the

methodbywhichthestepscanbeincorporatedintogivencompiler,suchastheLEGO

Compiler, developed by the Tinker Research Group. We feel this methodology is of

value because a novice engineer can follow these steps and produce a design that is

several times faster than a generalpurpose processor implementation.

Figure3.1shows the major stepsof ourdesign methodology. Wehaveautomated

some portions of the program analysis step, shown in the highlighted box. What

follows is an overview of the design methodology. We include a brief overview of

some of the compilation techniques that can be incorporated into our methodology.

3.2 The Proposed Design Methodology

Step 1: Perform Analysis of Input Program

The rst step in the mapping process is to perform an extensive analysis of the

input program. This analysis includesdetermining the compute intensive regions of

theprogramanddeterminingtheparallelisminherentintheprogram. Anyadditional

(46)

Perform Analysis of

Input Program

Determine Host/

Hardware Interface

Implement

ware Modules

Incrementally Map

Modules to FPGA

Design Software/

Hardware Interface

Design Controller

for Hardware

Figure 3.1: Methodology for mappingapplications toR.C. systems.

We consider this step to be the most important part of the design methodology.

This step involves determining the various options available for implementing the

applicationonthe R.C. system. Aftercompleting this step,the designer shouldhave

ageneralideaof howfasttheresultingimplementationwillbe. Thetasksspeciedin

this step canbe viewed asaset of heuristics forreducing the searchable designspace

(47)

tediousprocess of creating, synthesizing, and debuggingahardware implementation.

This step iscomposed of the followingtasks:

A.) Createloopblock and superblock representation of the program.

B.) Perform dependence analysis of loops and superblocks.

C.) Perform timing analysis of loops and superblocks.

D.) Determinepartitionsforwhichsuperblocksshouldbeimplementedinhardware

and software.

E.) Perform extensiveanalysis of the memory access patterns and determineloop

and superblock input requirements.

F.) Apply software pipelining techniques to produce pipelined implementation of

hardware loops and superblocks.

G.) Apply vectorization and software tilingtechniques to produce parallel

imple-mentation ofsoftware blocks and reduceinteraction with memory(if needed).

Step 1.A: Create Loop Block and Superblock Representation of Program

The rst task in the analysis of the application is to partition the Rebel code into

loops and superblocks. The looprepresentation is useful because many of the

com-putationally intensive portions of our applications are contained inside of loops. In

addition,theloopconstructsmaybeused bythe optimizationtechniques comprising

the latter stages of this step.

Theremainderoftheprogramwillberepresented withsuperblocks. Asuperblock

is a collection of instructions with a single entry point. There may be several exit

points inasuperblock. This representation can be usedto partitionentire regionsof

(48)

For example,the following isthe pseudo-code for the PNN algorithm[67]:

Algorithm: PNN Multispectral Image Classication

Input: X;n;d;W;P;k;K1; and K2

where X is the set of n 2

image pixels, each containing d bands; W is the

set of weights, P is the set of the number of weights for the given classes,

k is the number of classes, and K1 and K2 are the sets of K1 and K2

constants, respectively

Output: New image vector, X 0

, where each pixel of X 0

represents the

classification of the corresponding pixel in X

For pixel=1 to n DO

winner= 1;

maxval = 1;

For class=1 to k DO

c

sum

=0:0;

For weight=1 to P

k DO

p

sum

=0:0;

For band=1 to d DO

diff =X

pixel ;band W cl ass pixel ;band ; p sum

+=diff 2

;

End For // band loop

k2 mul t =K2 cl ass p sum ; c sum +=e

k2

mult

;

End For // weight loop

c

sum

=K1

(49)

If c

sum

>maxval

maxval =c

sum ;

winner=class;

End If

End For // class loop

X 0

pixel

=winner;

End For //pixel loop

Figure 3.2 shows a loop representation of the two inner loops (weight and band

loop). Each block represents a basic block. Block 1 contains the instructions for

initializingtheweightloopandp

sum

. Block2containsthe instructionsforcalculating

the variables diff and p

sum

. Please note that this block is performed four times for

each iteration of the outer loop. Block 3 contains the instructions for calculating

the variables k2

mul t

and c

sum

. This representation was obtained using the LEGO

compiler.

Step 1.B: Perform Dependence Analysis of Loops and Superblocks

The second taskisto determine the dependence between and within variablesin the

loops and superblocks. The dependence between blocks can be used todetermine if

it is possible to execute two blocks simultaneously, or shift their ordering. This is

useful because it would possibly allow the host processor to execute some segments

of code while the hardware executes other segments. The LEGO compilerhas some

supportfor dependence analysis.

Step 1.C: Perform Timing Analysis of Loops and Superblocks

The next task is to perform a timing analysis of the blocks. This analysis is an

(50)

Block 1

Initialize Weight Counter

Reset Band Sum

Block 2

Calculate Diff

Calculate Band Sum

Block 3

Calculate K2 Mult

Calculate Class Sum

Figure3.2: Loopblock representation of inner loops for PNN.

to run on the host, and the amount of speedup we must attain to meet the user

specied constraints. Wedene speedup as:

T

GP

T

RC

(3.1)

where T

GP

is the execution time of the general purpose processor implementation,

and T

RC

isthe execution time of the RCimplementation.

Step 1.D: Partition Hardware and Software Components

Thefourthtaskistopartitiontheblocksintohardwareandsoftwarecomponents. The

techniques used in hardware/software co-design (HSC), such as simulated annealing

or genetic algorithms, can be applied directly to the blocks [68] to determine which

blocksshouldbeimplementedinhardware,andtherespectivetimingconstraint. HSC

(51)

Step 1.E: Perform Analysis of Memory Access Patterns

The fth task is to perform an analysis of the memory accesses. Here, the number

of memory accesses required for each loop iteration and superblock should be

de-termined. The extent of memory reuse should also be determined during this step

to remove repeated loading and storage of data from/to memory. In addition, the

validity of transformations foroptimizingloopperformance should be determined.

Step 1.F: Apply Software Pipelining Techniques

If timing constraints are met, the last step is the pipelining of loop bodies, which

providesa largeamount ofspeedup forscientic applications [67]. Given ahardware

architecture, software pipelining techniques [70, 71,72,73, 74]can beused to

deter-mine a schedule that overlaps the execution of successive iterations of a loop with

previousiterations. Thehardware architecturesusedinthismethodologyarederived

directly fromthe data-owgraph of the loopbody.

Step 1.G: Apply Vectorization and Tiling Techniques

If pipelining does not provide enough improvement in execution time, vectorization

andtilingtechniquescanbeappliedtoexploitcoarsegrainparallelismintheprogram.

He

References

Related documents

Matthew 5:31 It has been said, Whosoever shall put away his wife, let him give her a writing of a writing of a writing of a writing of a writing of divorcement..

The object of this study will be to compare and contrast means of effective communication throughout the public and private sector in Albania and how this effective

P ri vijačnem steblu računam o največkrat s čisto osno natezno obrem enitvijo, najm anjšo ploskev pa prikazuje tista prerezna ravnina, ki leži pravokotno na

than  of  substance.  The  more  they  learn,  the  more  scientists  discover  that  there  is  yet  more  to . learn     

Casuals in positions that require special certification or license (such as emergency medical technicians, drivers, or instructors) must meet the requirements of the hiring agency

Two methods of wage’s decomposition are used for the empirical analysis (Oaxaca-Blinder 1973, Juhn- Murphy and Pierce 1991) to identify which part of the wage

The objective of this clinical trial was to evaluate the safety and effectiveness of the coflex ® device for the treatment of 1 or 2-level lumbar stenosis with or

Study of mobile adoption by older adults increases the understanding of older adults’ ability to continue working and learning due to the growth of mobile learning, the