Data Processing On FPGAs
Data Processing On FPGAs
YNTHESIS L
LECTURES
ECTURES ON
ON D
DATA
ATA M
MANAGEMENT
ANAGEMENT
Series
Series
SeriesEditor:
Editor:
Editor:M.
M.
M.Tamer
Tamer
Tamerzsu,
zsu,
zsu,University
University
Universityof
of
ofWaterloo
Waterloo
Waterloo
TEUBNER WOODS
WOODS
TEUBNER
Series
Series
SeriesISSN:
ISSN:
ISSN:2153-5418
2153-5418
2153-5418
Data
DataProcessing
Processingon
onFPGAs
FPGAs
Jens
Jens
JensTeubner,
Teubner,
Teubner,Databases
Databases
Databasesand
and
andInformation
Information
InformationSystems
Systems
SystemsGroup,
Group,
Group,Dept.
Dept.
Dept.ofofofComputer
Computer
ComputerScience,
Science,
Science,TU
TU
TUDortmund
Dortmund
Dortmund
Louis
Louis
LouisWoods,
Woods,
Woods,Systems
Systems
SystemsGroup,
Group,
Group,Dept.
Dept.
Dept.of
of
ofComputer
Computer
ComputerScience,
Science,
Science,ETH
ETH
ETHZrich
Zrich
Zrich
DATA PROCESSING
PROCESSING ON
ON FPGAS
FPGAS
DATA
Roughly
Roughly
Roughlyaaadecade
decade
decadeago,
ago,
ago,power
power
powerconsumption
consumption
consumptionand
and
andheat
heat
heatdissipation
dissipation
dissipationconcerns
concerns
concernsforced
forced
forcedthe
the
thesemiconductor
semiconductor
semiconductorindustry
industry
industry
to
to
toradically
radically
radicallychange
change
changeits
its
itscourse,
course,
course,shifting
shifting
shiftingfrom
from
fromsequential
sequential
sequentialto
to
toparallel
parallel
parallelcomputing.
computing.
computing.Unfortunately,
Unfortunately,
Unfortunately,improving
improving
improving
performance
performance
performanceof
of
ofapplications
applications
applicationshas
has
hasnow
now
nowbecome
become
becomemuch
much
muchmore
more
moredifficult
difficult
difficultthan
than
thanin
in
inthe
the
thegood
good
goodold
old
olddays
days
daysof
of
offrequency
frequency
frequency
scaling.
scaling.
scaling.This
This
Thisisisisalso
also
alsoaffecting
affecting
affectingdatabases
databases
databasesand
and
anddata
data
dataprocessing
processing
processingapplications
applications
applicationsin
in
ingeneral,
general,
general,and
and
andhas
has
hasled
led
ledto
to
tothe
the
thepopularity
popularity
popularity
of
of
ofso-called
so-called
so-calleddata
data
dataappliancesspecialized
appliancesspecialized
appliancesspecializeddata
data
dataprocessing
processing
processingengines,
engines,
engines,where
where
wheresoftware
software
softwareand
and
andhardware
hardware
hardwareare
are
aresold
sold
sold
together
together
togetherin
in
inaaaclosed
closed
closedbox.
box.
box.Field
Field
Fieldprogrammable
programmable
programmablegate
gate
gatearrays
arrays
arrays(FPGAs)
(FPGAs)
(FPGAs)increasingly
increasingly
increasinglyplay
play
playan
an
animportant
important
importantrole
role
rolein
in
insuch
such
such
systems.
systems.
systems.FPGAs
FPGAs
FPGAsare
are
areattractive
attractive
attractivebecause
because
becausethe
the
theperformance
performance
performancegains
gains
gainsof
of
ofspecialized
specialized
specializedhardware
hardware
hardwarecan
can
canbe
be
besignificant,
significant,
significant,while
while
while
power
power
powerconsumption
consumption
consumptionisisismuch
much
muchless
less
lessthan
than
thanthat
that
thatof
of
ofcommodity
commodity
commodityprocessors.
processors.
processors.On
On
Onthe
the
theother
other
otherhand,
hand,
hand,FPGAs
FPGAs
FPGAsare
are
areway
way
way
more
more
moreflexible
flexible
flexiblethan
than
thanhard-wired
hard-wired
hard-wiredcircuits
circuits
circuits(ASICs)
(ASICs)
(ASICs)and
and
andcan
can
canbe
be
beintegrated
integrated
integratedinto
into
intocomplex
complex
complexsystems
systems
systemsin
in
inmany
many
manydifferent
different
different
ways,
ways,
ways,e.g.,
e.g.,
e.g.,directly
directly
directlyin
in
inthe
the
thenetwork
network
networkfor
for
foraaahigh-frequency
high-frequency
high-frequencytrading
trading
tradingapplication.
application.
application.This
This
Thisbook
book
bookgives
gives
givesan
an
anintroduction
introduction
introduction
to
to
toFPGA
FPGA
FPGAtechnology
technology
technologytargeted
targeted
targetedat
at
ataaadatabase
database
databaseaudience.
audience.
audience.In
In
Inthe
the
thefirst
first
firstfew
few
fewchapters,
chapters,
chapters,we
we
weexplain
explain
explainin
in
indetail
detail
detailthe
the
theinner
inner
inner
workings
workings
workingsof
of
ofFPGAs.
FPGAs.
FPGAs.Then
Then
Thenwe
we
wediscuss
discuss
discusstechniques
techniques
techniquesand
and
anddesign
design
designpatterns
patterns
patternsthat
that
thathelp
help
helpmapping
mapping
mappingalgorithms
algorithms
algorithmsto
to
toFPGA
FPGA
FPGA
hardware
hardware
hardwareso
so
sothat
that
thatthe
the
theinherent
inherent
inherentparallelism
parallelism
parallelismof
of
ofthese
these
thesedevices
devices
devicescan
can
canbe
be
beleveraged
leveraged
leveragedin
in
inan
an
anoptimal
optimal
optimalway.
way.
way.Finally,
Finally,
Finally,the
the
thebook
book
book
will
will
willillustrate
illustrate
illustrateaaanumber
number
numberof
of
ofconcrete
concrete
concreteexamples
examples
examplesthat
that
thatexploit
exploit
exploitdifferent
different
differentadvantages
advantages
advantagesof
of
ofFPGAs
FPGAs
FPGAsfor
for
fordata
data
dataprocessing.
processing.
processing.
M
Mor
Mor
Morgan
gan
gan&
Cl
Cl
Claypool
aypool
aypool Publishers
Publishers
Publishers
&
&C
Data Processing on
FPGAs
Jens
JensTeubner
Teubner
Louis
Louis Woods
Woods
About
About
AboutSYNTHESIs
SYNTHESIs
SYNTHESIs
&
&
&
Mor
Mor
Morgan
gan
gan
ISBN:
ISBN:
ISBN: 978-1-62705-060-9
978-1-62705-060-9
978-1-62705-060-9
90000
90000
90000
Cl
Cl
Claypool
aypool
aypool Publishers
Publishers
Publishers
w
w
ww
w
ww
w
w...m
m
mooorrrgggaaannnccclllaaayyypppoooooolll...cccooom
m
m
9
9
9781627
781627
781627050609
050609
050609
MOR GAN
GAN &
& CL
CL AYPOOL
AYPOOL
MOR
MOR
GAN
&
CL
AYPOOL
This
This
Thisvolume
volume
volumeisisisaaaprinted
printed
printedversion
version
versionof
of
ofaaawork
work
workthat
that
thatappears
appears
appearsin
in
inthe
the
theSynthesis
Synthesis
Synthesis
Digital
Digital
DigitalLibrary
Library
Libraryof
of
ofEngineering
Engineering
Engineeringand
and
andComputer
Computer
ComputerScience.
Science.
Science.Synthesis
Synthesis
SynthesisLectures
Lectures
Lectures
provide
provide
provideconcise,
concise,
concise,original
original
originalpresentations
presentations
presentationsof
of
ofimportant
important
importantresearch
research
researchand
and
anddevelopment
development
development
topics,
topics,
topics,published
published
publishedquickly,
quickly,
quickly,in
in
indigital
digital
digitaland
and
andprint
print
printformats.
formats.
formats.For
For
Formore
more
moreinformation
information
information
visit
visit
visitwww.morganclaypool.com
www.morganclaypool.com
www.morganclaypool.com
SSYNTHESIS
YNTHESIS L
LECTURES
ECTURES ON
ON D
DATA
ATA M
MANAGEMENT
ANAGEMENT
M.
M.
M.Tamer
Tamer
Tamerzsu,
zsu,
zsu,Series
Series
SeriesEditor
Editor
Editor
Synthesis Lectures on Data Management is edited by Tamer zsu of the University of Waterloo.
e series will publish 50- to 125 page publications on topics pertaining to data management. e
scope will largely follow the purview of premier information and computer science conferences, such
as ACM SIGMOD, VLDB, ICDE, PODS, ICDT, and ACM KDD. Potential topics include, but
not are limited to: query languages, database system architectures, transaction management, data
warehousing, XML and databases, data stream systems, wide scale data distribution, multimedia
data management, data mining, and related subjects.
Semantics Empowered Web 3.0: Managing Enterprise, Social, Sensor, and Cloud-based
Data and Services for Advanced Applications
Amit Sheth and Krishnaprasad irunarayan
2012
iii
Declarative Networking
Boon au Loo and Wenchao Zhou
2012
iv
Probabilistic Databases
Dan Suciu, Dan Olteanu, Christopher R, and Christoph Koch
2011
Database Replication
Bettina Kemme, Ricardo Jimenez-Peris, and Marta Patino-Martinez
2010
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in
any form or by any meanselectronic, mechanical, photocopy, recording, or any other except for brief quotations
in printed reviews, without the prior permission of the publisher.
ISBN: 9781627050609
ISBN: 9781627050616
paperback
ebook
DOI 10.2200/S00514ED1V01Y201306DTM035
Jens Teubner
Databases and Information Systems Group, Dept. of Computer Science, TU Dortmund
Louis Woods
Systems Group, Dept. of Computer Science, ETH Zrich
M
&C
ABSTRACT
Roughly a decade ago, power consumption and heat dissipation concerns forced the semiconductor industry to radically change its course, shifting from sequential to parallel computing.
Unfortunately, improving performance of applications has now become much more dicult than
in the good old days of frequency scaling. is is also aecting databases and data processing
applications in general, and has led to the popularity of so-called data appliancesspecialized
data processing engines, where software and hardware are sold together in a closed box. Fieldprogrammable gate arrays (FPGAs) increasingly play an important role in such systems. FPGAs
are attractive because the performance gains of specialized hardware can be signicant, while
power consumption is much less than that of commodity processors. On the other hand, FPGAs
are way more exible than hard-wired circuits (ASICs) and can be integrated into complex systems in many dierent ways, e.g., directly in the network for a high-frequency trading application.
is book gives an introduction to FPGA technology targeted at a database audience. In the rst
few chapters, we explain in detail the inner workings of FPGAs. en we discuss techniques and
design patterns that help mapping algorithms to FPGA hardware so that the inherent parallelism
of these devices can be leveraged in an optimal way. Finally, the book will illustrate a number of
concrete examples that exploit dierent advantages of FPGAs for data processing.
KEYWORDS
FPGA, modern hardware, database, data processing, stream processing, parallel algorithms, pipeline parallelism, programming models
ix
Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1
1.2
1.3
1.4
1.5
1.6
1.7
2.2
2.3
FPGAs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
4.2
4.3
4.4
xi
4.5
5.2
5.3
5.4
5.5
5.6
Accelerated DB Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.1
6.2
Sort Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.1.1 Sorting Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.1.2 BRAM-based FIFO Merge Sorter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
6.1.3 External Sorting with a Tree Merge Sorter . . . . . . . . . . . . . . . . . . . . . . . 74
6.1.4 Sorting with Partial Reconguration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Skyline Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
6.2.1 Standard Block Nested Loops (BNL) Algorithm . . . . . . . . . . . . . . . . . . 77
6.2.2 Parallel BNL with FPGAs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
6.2.3 Performance Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
xii
7.2
7.3
7.4
Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
NetFPGA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Solarares ApplicationOnload Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Fusion I/Os ioDrive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Authors Biographies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
xiii
Preface
System architectures, hardware design, and programmable logic (specically, eld-programmable
gate arrays or FPGAs) are topics generally governed by electrical engineers. Hardware people
are in charge of embracing technological advantages (and turning them into improved performance), preferably without breaking any of the established hardware/software interfaces, such as
instruction sets or execution models.
Conversely, computer scientists and software engineers are responsible for understanding
users problems and satisfying their application and functionality demands. While doing so, they
hardly care how hardware functions underneathmuch as their hardware counterparts are largely
unaware of how their systems are being used for concrete problems.
As time progresses, this traditional separation between hard- and software leaves more
and more potential of modern technology unused. But giving up the separation and building
hardware/software co-designed systems requires that both parties involved understand each others
terminology, problems/limitations, requirements, and expectations.
With this book we want to help work toward this idea of co-designed architectures.
Most importantly, we want to give the software side of the storythe database community in
particulara basic understanding of the involved hardware technology. We want to explain what
FPGAs are, how they can be programmed and used, and which role they could play in a database
context.
is book is intended for students and researchers in the database eld, including those
that have not had much contact with hardware technology in the past, but would love to get
introduced to the eld. At ETH Zrich/TU Dortmund, we have been teaching for several years
a course titled Data Processing on Modern Hardware. e material in this book is one part of
that Master-level course (which further discusses also modern hardware other than FPGAs).
We start the book by highlighting the urgent need from the database perspective to invest
more eort into hardware/software co-design issues (Chapter 1). Chapters 2 and 3 then introduce
the world of electronic circuit design, starting with a high-level view, then looking at FPGAs
specically. Chapter 3 also explains how FPGAs work internally and why they are particularly
attractive at the present time.
In the remaining chapters, we then show how the potential of FPGAs can be turned into
actual systems. First, we give general guidelines how algorithms and systems can be designed
to leverage the potential of FPGAs (Chapter 4). Chapter 5 illustrates a number of examples
that successfully used FPGAs to improve database performance. But FPGAs may also be used to
enable new database functionality, which we discuss in Chapter 7 by example of a database crypto
xiv
PREFACE
co-processor. We conclude in Chapter 8 with a wary look into the future of FPGAs in a database
context.
A short appendix points to dierent avors of FPGA system integration, realized through
dierent plug-ins for commodity systems.
Jens Teubner and Louis Woods
June 2013
CHAPTER
Introduction
For decades, performance of sequential computation continuously improved due to the stunning
evolution of microprocessors, leaving little room for alternatives. However, in the mid-2000s,
power consumption and heat dissipation concerns forced the semiconductor industry to radically
change its course, shifting from sequential to parallel computing. Ever since, software developers
have been struggling to achieve performance gains comparable to those of the past. Specialized
hardware can increase performance signicantly at a reduced energy footprint but lacks the necessary exibility. FPGAs (reprogrammable hardware) are an interesting alternative, which have
similar characteristics to specialized hardware, but can be (re)programmed after manufacturing.
In this chapter, we give an overview of the problems that commodity hardware faces, discuss how
FPGAs dier from such hardware in many respects, and explain why FPGAs are important for
data processing.
1.1
Ever since Intel co-founder Gordon E. Moore stated his famous observation that the number of
transistors on integrated circuits (IC) doubles roughly every two years, this trend (Moores law)
has continued unhalted until the present day. e driving force behind Moores law is the continuous miniaturization of the metal oxide semiconductor (MOS) transistor, the basic building block
of electronic circuits. Transistor dimensions have been shrunk by about 30 % every two years, resulting in an area reduction of 50 %, and hence the doubling of transistors that Moore observed.
Transistor scaling has not only led to more transistors but also to faster transistors (shorter
delay times and accordingly higher frequencies) that consume less energy. e bottom line is that,
in the past, every generation of transistors has enabled circuits with twice as many transistors,
an increased speed of about 40 %, consuming the same amount of energy as the previous generation, despite 50 % more transistors. e theory behind this technology scaling was formulated
by Dennard et al. [1974] and is known as Dennards scaling. ere was a time when Dennards
scaling accurately reected what was happening in the semiconductor industry. Unfortunately,
those times have passed for reasons that we will discuss next.
1.2
Just like CPUs, o-chip dynamic memory (DRAM) has also been riding Moores law but due
to economic reasons with a dierent outcome than CPUs. Whereas memory density has been
1. INTRODUCTION
doubling every two years, access speed has improved at a much slower pace, i.e., today, it takes
several hundred CPU cycles to access o-chip memory. DRAM is being optimized for large
capacity at minimum cost, relying on data locality and caches in the CPU for performance. us,
a signicant gap between processor speed and memory speed has been created over the years, a
phenomenon known as the memory wall.
Furthermore, the majority of computers today are built according to the Von Neumann
model, where data and software programs are stored in the same external memory. us, the bus
between main memory and the CPU is shared between program instructions and workload data,
leading to the so-called Von Neumann bottleneck.
To mitigate the negative eects of both the memory wall and the Von Neumann bottleneck,
CPUs use many of the available transistors to implement all sorts of acceleration techniques to
nonetheless improve performance, e.g., out-of-order execution, branch prediction, pipelining,
and last but not least cache hierarchies. In fact, nowadays a substantial amount of transistors and
die area (up to 50 %) are used for caches in processors.
1.3
POWER WALL
In the past, frequency scaling, as a result of transistor shrinking, was the dominant force that increased performance of commodity processors. However, this trend more or less came to an end
about a decade ago. As already mentioned in the previous section, the advantages of higher clock
speeds are in part negated by the memory wall and Von Neumann bottleneck, but more importantly, power consumption and heat dissipation concerns forced the semiconductor industry to stop
pushing clock frequencies much further.
Higher power consumption produces more heat, and heat is the enemy of electronics. Too
high temperatures may cause an electronic circuit to malfunction or even damage it permanently.
A more subtle consequence of increased temperature is that transistor speed decreases, while
current leakage increases, producing even more heat. erefore, silicon chips have a xed power
budget, which microprocessors started to exeed in the mid-2000s, when frequency scaling hit the
so-called power wall.
A simplied equation that characterizes CPU power consumption (PCP U ) is given below.
We deliberately ignore additional terms such as short circuit and glitch power dissipation, and focus
on the most important components: dynamic power and static power.
PCP U D C Vd2d. fclk C Vdd Ileak
dynamic power
static power
Dynamic power is the power consumed when transistors are switching, i.e., when transistors are changing their state. e parameter characterizes the switching activity, C stands for
capacitance, Vdd for voltage, and fclk corresponds to the clock frequency. Static power, on the
other hand, is the power consumed even when transistors are inactive, because transistors always
leak a certain amount of current (Ileak ).
As transistors became smaller (< 130 nanometers), reality increasingly started to deviate
from Dennards theory, i.e., the reduced voltage of smaller transistor was no longer sucient to
compensate fully for the increased clock speed and the larger number of transistors. For a number
of reasons, voltage scaling could no longer keep up with frequency scaling, leading to excessive
power consumption.
Unfortunately, limiting frequency scaling solved the power consumption issue only temporarily. As transistor geometries shrink, a higher percentage of current is leaked through the
transistor. As a result, static power consumption, which is independent of the clock frequency,
is increased. us, to avoid hitting the power wall again, in the future, an increasing amount of
transistors will need to be powered o, i.e., it will only be possible to use a fraction of all available
transistors at the same time.
1.4
As Moores law prevailed but frequency scaling reached physical limits, there was a major shift
in the microprocessor industry toward parallel computing: instead of aiming for ever-increasing
clock frequencies of a single core, multiple identical cores are now placed on the same die. Unfortunately, there are a number of issues with multicore scaling. First of all, performance is now
directly dependant on the degree of parallelism that can be exploited for a given task. Amdahls
law states that if a fraction f of computation is enhanced by a speedup of S , then the overall
speedup is:
1
speedup D
:
.1 f / C fS
In the case of multicores, we can interpret f as the fraction of parallelizable computation (assuming perfect parallelization), and S as the number of cores. us, as the number of cores increases,
so does the pressure to be able to exploit maximum parallelism from a task. However, as Hill
and Marty [2008] observed, a parallel architecture that relies on large amounts of homogeneous,
lean cores is far from optimal to extract the necessary parallelism from a task. Hill and Marty
[2008] suggest that an asymmetric architecture would be better suited, while they see the highest
potential in dynamic techniques that allow cores to work together on sequential execution.
Graphic processors (GPUs), in a sense, are an extreme version of multicore processors. In a
GPU there are hundreds of very lean cores that execute code in lockstep. GPUs have the same
problems with Almdahls law as multicore CPUs. In fact, the more primitive GPU cores and
the way threads are scheduled on them, reduces exibility, making it even more dicult to extract
suitable parallelism from arbitrary applications that would allow an eective mapping to the GPU
architecture.
1. INTRODUCTION
1.5
SPECIALIZED HARDWARE
Dark silicon [Esmaeilzadeh et al., 2011] refers to the underutilization of transistors due to power
consumption constraints and/or inecient parallel hardware architectures that conict with Amdahls law. A promising way to overcome these limitations is a move toward heterogeneous architectures, i.e., where not all cores are equal and tasks are o-loaded to specialized hardware to
both improve performance and save energy. is conclusion is similar to the one size does not
t all concept [Stonebraker et al., 2007] from database research although applied to hardware
architectures.
Instead of mapping a given task to a xed general-purpose hardware architecture, specialized hardware is mapped to the task at hand. Dierent problems require dierent forms of
parallelism, e.g., data parallelism versus pipeline parallelism, coarse-grained parallelism vs. negrained parallelism. Custom hardware allows employing the most eective form of parallelization
that best suits a given task.
Specialized hardware is neither bound to the Von Neumann bottleneck nor does it necessarily
suer from the memory wall. For instance, custom hardware that needs to monitor network data,
e.g., for network intrusion detection or high-frequency trading, can be coupled directly with a
hardware Ethernet controller. us, the slow detour via system bus and main memory is avoided.
Consequently, the need for large caches, branch prediction, etc., dissolves, which saves chip space
and reduces power consumption.
Power consumption of specialized hardware solutions is usually orders of magnitude below
that of general-purpose hardware such as CPUs and GPUs. Knowing exactly what kind of a
problem the hardware is supposed to solve, allows using transistors much more eectively. Also,
due to specialized hardware parallelism and avoidance of the Von Neumann bottleneck, lower clock
frequencies are typically sucient to eciently solve a given task, which further reduces power
consumption. For instance, a circuit that handles 10G Ethernet trac processes 64-bit words at
a clock speed of only 156.25 MHz.
Nevertheless, specialized hardware also has a number of drawbacks, and in the past systems
that were built from custom hardware (e.g. database machines in the 1980s) typically lost the
race against systems based on general-purpose hardware. First of all, building custom hardware
is a dicult and time-consuming process. Second, potential bugs usually cannot be solved after
manufacturing, making testing even more time-consuming, and also increasing the risk associated
with producing specialized hardware. ird, unless the custom hardware is mass-produced, it
is signicantly more expensive than general-purpose hardware. In the past, frequency scaling
improved sequential computation performance to such an extent that in many domains custom
hardware solutions were simply uneconomical.
1.6
1.7
Originally, FPGAs were primarily used as glue logic on printed circuit boards (PCBs), and later on
also for rapid prototyping. However, more than two decades of FPGA technology evolution have
allowed FPGAs to emerge in a variety of elds, as a class of customizable hardware accelerators
that address the increasing demands for performance, with a low energy footprint, at aordable
cost. In recent years, increased attention from both academia and industry has been drawn to
using FPGAs for data processing tasks, which is the domain that this book focuses on.
1. INTRODUCTION
Another example illustrating the advantages of FPGAs are network intrusion detection systems (NIDSs) that scan incoming network packets, attempting to detect malicious patterns. Typically there are several hundred patterns formulated as regular expressions, which all need to be
evaluated in real time. e regular expressions can easily be implemented in hardware as nite state
machines (FSMs), which, on an FPGA, can then all be executed in parallel. us, besides the integration and reprogramming capabilities, here the inherent parallelism of FPGAs is exploited to
achieve unprecedented performance.
buer overow attacks or rootkits possible. In hardware, on the other hand, data and program
can be easily separated, e.g., the program can be implemented in logic (protected by the root of
trust), while data are stored in memory. Based on these ideas Arasu et al. [2013] built the Cipherbase system, which extends Microsofts SQL Server with FPGA-based secure hardware to
achieve high data condentiality and high performance.
In a buer overow attack, a data buers boundary is intentionally overrun such that data are written into adjacent memory.
For instance, if the attacker can guess where the program code is stored, this method can be used to inject malicious code.
A rootkit is software that typically intercepts common API calls, and is designed to provide administrator privileges to a user
without being detected. A buer overow could be exploited to load a rootkit.
CHAPTER
2.1
A
B
.
XOR
AND
i n0
AND
Inverter
10
i n1
OR
out
AND
sel
Figure 2.1: Combining basic logic gates to construct more complex circuits: a half adder (left) and a
two-input multiplexer (right).
expressions, i.e., if-then-else expressions of the form out = (sel ) ? i n1 : i n0 , where sel determines
whether i n1 or i n0 is selected for the output.
Combinational logic is purely driven by the input data, i.e., in the examples in Figure 2.1,
no clock is involved and no explicit synchronization is necessary. Notice that each logic gate has a
xed propagation delay, i.e., the time it takes before the eect of driving input signals is observable
at the output of a gate. Propagation delays result from physical eects, such as signal propagation
times along a signal wire or switching speeds of transistors. Combining multiple gates increases
the overall propagation delay, i.e., the propagation delay of a complex combinational circuit comprises the sum of propagation delays of its gates along the longest path within the circuit, known
as the critical path. e critical path determines the maximum clock speed of sequential circuits,
which we will discuss next.
in
combinational
.
logic
out
XNOR
S
Q
state
element
clk
S
XNOR
11
Figure 2.2: A sequential circuit with a feedback loop (left), the internals of an S-R (NOR) latch
(center), and symbol of a D ip-op (right).
12
is implemented using two latches in combination with additional logic gates. Most D ip-ops
allow the D and clk port to be bypassed, forcing the ip-op to set or reset state, via separate
S=R ports.
e main reason for the ubiquitous use of synchronous sequential logic is its simplicity. e
clock frequency determines the length of a clock period and all combinational logic elements are
required to nish their computation within that period. If these conditions are met the behaviour
of the circuit is predictable and reliable. On the ip-side, maximum clock frequency is determined
by the critical path in a circuit, i.e., by the longest combinational path between any two ip-ops.
As a consequence, the potential performance of other faster combinational elements cannot be
maxed out.
2.2
HARDWARE PROGRAMMING
In the early days of electronic circuit design, schematics were the only formal way to represent a
circuit. us, circuits used to be drawn (e.g., as the circuits depicted in Figure 2.1) by hand or
using a computer-aided design (CAD) tool. Today, the most common way to design a circuit is
using an appropriate hardware description language (HDL), which is better suited to capture the
complexity of large circuits, and signicantly increases productivity.
module m u l t i p l e x e r (
i n p u t in0 , i n1 , s e l ,
output out
);
wire n s e l ;
wire out0 ;
wire out1 ;
inverter
andgate
andgate
orgate
inv0 ( sel
and0 ( i n0
and1 ( i n1
o r 0 ( out0
13
module m u l t i p l e x e r (
i n p u t in 0 , in 1 , s e l ,
output out
);
assign out = s e l ? in1 : in0 ;
endmodule
, nsel );
, nsel , out0 ) ;
, s e l , out1 ) ;
, out1 , o u t ) ;
endmodule
e multiplexer displayed in Listing 2.1 is a structural implementation of a 2-to-1 multiplexer. at is, the multiplexer was built bottom-up by combining multiple instantiations of simpler modules into a single, more complex module. However, often it is benecial to model a
complex system prior to detailed architecture development. erefore, common HDLs also support a top-down method for designing a circuit, known as behavioral modeling. Listing 2.2 shows
the same 2-to-1 multiplexer implemented using behavioral Verilog. Whereas structural modeling
is an imperative technique, exactly dening how a circuit is constructed, behavioral modeling is a
declarative technique, specifying the behavior rather than the architecture of a circuit.
Simulation
Since producing a hardware circuit is a costly and lengthy process, simulation is a crucial tool for
designing hardware circuits economically. Simulation is so fundamental that supporting mechanisms are directly integrated into the HDL.
ere are various levels of granularity at which a circuit can be simulated. e rst step in
the design process of a circuit is usually to verify the behavioral correctness of a circuit. For that
matter, a behavioral model of the circuit is implemented and an appropriate testbench is created
within the HDL. A software simulator can then evaluate the circuit against the test cases specied
in the testbench.
Later in the design process, behavioral components are gradually replaced by structural
ones, and other aspects than logical correctness, e.g., adherence to timing constraints, become
important. HDLs also support this form of simulation, e.g., modules can be annotated with estimated timing information such as propagation delay, etc., and a simulator can check whether a
circuit can sustain a given clock rate.
route
physical
place
technology
mapping
logic optimization
RTL
synthesis
RTL
behavioral
circuit .
specication
high-level
synthesis
logical
manufacturing
technology
library
RTL
netlist
14
constraints
Figure 2.3: Design ow: formal circuit specication ! physical circuit.
2.3
CIRCUIT GENERATION
In this section we briey discuss the design ow for producing a physical circuit from a formal
specication, written in some HDL or higher-level language. e main steps are illustrated in
Figure 2.3. Most of these steps are also relevant for FPGA programming, which we will discuss
in the next chapter.
15
an ASIC or program an FPGA. To reach an RTL model of a circuit, manual design and tuning
may be necessary. However, once an RTL model of a circuit exists, all further processing steps
(including RTL synthesis) toward the physical circuit are fully automated.
An RTL synthesizer translates the RTL circuit description into an internal representation
of unoptimized Boolean logic equations. e next step is a technology-independent optimization
of these equations, i.e., redundant logic is automatically removed.
e nal step of the synthesis process is to implement the abstract internal representation of
the design by mapping it to the cells of a technology library (also known as cell library, provided by
the device manufacturer. e cells of a technology library range from basic logic gates (standard
cells) to large and complex megacells with ready-to-use layout (e.g., a DMA controller). e
library consists of cell descriptions that contain information about functionality, area, timing, and
power for each cell. As illustrated in Figure 2.3, the technology mapping process also takes design
constraints into account. ese constraints, e.g. regarding area consumption, timing, and power
consumption, guide the mapping process, and determine which cells are selected when multiple
options exist.
17
CHAPTER
FPGAs
In this chapter, we give an overview of the technology behind eld-programmable gate arrays (FPGAs). We begin with a brief history of FPGAs before we explain the key concepts that make
(re)programmable hardware possible. We do so in a bottom-up approach, that is, we rst discuss the very basic building blocks of FPGAs, and then gradually zoom out and show how the
various components are combined and interconnected. We then focus on programming FPGAs
and illustrate a typical FPGA design ow, also covering advanced topics such as dynamic partial
reconguration. Finally, to complete the picture of modern FPGAs, we highlight bleeding-edge
technology advances and future FPGA trends.
3.1
Field-programmable gate arrays (FPGAs) arose from programmable logic devices (PLDs), which
rst appeared in the early 1970s. PLDs could be programmed after manufacturing in the eld.
However, programmability in these devices was limited, i.e., programmable logic was hard-wired
between logic gates.
In 1985, the rst commercially available FPGA (the Xilinx XC2064) was invented. is
device hosted arrays of congurable logic bocks (CLBs) that contained the programmable gates, as
well as a programmable interconnect between the CLBs.
Early FPGAs were usually used as glue logic between other xed hardware components.
However, the tremendous development of FPGAs in the 1990s, made FPGAs an attractive alternative to ASICs for prototyping, small volume production, for products with a short time to
market, or products that require frequent modications.
Today, FPGAs are enhanced with many additional hardware components that are integrated directly into the FPGA fabric such as embedded digital signal processing units (DSP),
network cores, and even full-edged processors, e.g., the ARM Cortex-A9, which is embedded in the Xilinx Zynq-7000 programmable SoC.
In summary, FPGAs have gone through an extreme evolution in the last three decades. Today, FPGAs provide massive parallelism, low power consumption, and high-speed I/O capabilities, which makes them interesting devices for data processing with compute- and data-intensive
workloads.
18
3. FPGAS
AND
Input
Output
00
01
10
11
0
0
0
1
OR
Input
Output
00
01
10
11
0
1
1
1
Figure 3.1: AND gate (left) and OR gate (right), each represented by a two-input LUT.
3.2
In Chapter 2, we saw that the three fundamental ingredients of any circuit are combinational logic
(compute), memory elements (storage), and interconnect (communication). In the following, we
will discuss these aspects in the context of FPGAs. In an ASIC, combinational logic is built from
wiring a number of physical basic logic gates together. In FPGAs, these logic gates are simulated
using multiple instances of a generic element called a look-up tableor simply LUT. As we will
see, LUTs can be (re)programmed after manufacturing, which makes them mainly responsible
for the (re)programmability property of FPGAs.
i n0
i n1
i n2
19
i n3
Conf. Bit
We
0
1
D
EN
D
EN
0
1
0
1
Clk
16 bits of SRAM
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
D
EN
0
1
0
1
out
out
0
1
0
1
LUT
LUT
Figure 3.2: Internal structure of a 4-input LUT: circuitry for reading (left) and writing (right).
nally, these SRAM cells are organized as shift registers (1-bit wide and 2n -bits deep), as depicted
on the right of Figure 3.2. us, the bits of the conguration bitstream are shifted bit-by-bit into
the LUTs when an FPGA is (re)programmed. us, an LUT can be read (asynchronously) in less
than a cycle but writing to an LUT requires 2n cycles. is reects one of the typical trade-os in
hardware designhere, write performance is traded for a simpler design and, as a result, reduced
chip space consumption.
20
3. FPGAS
carry-out
4-LUT
D
4-LUT
.
carry
logic
A
B
D
4-LUT
Ci n
XOR
XOR
carry
logic
carry
logic
Cout
elementary
logic unit
carry-in
Figure 3.3: Functionality within an elementary logic unit (left) and a full adder constructed by combining a LUT with elements of the carry logic (right).
3.3
FPGA ARCHITECTURE
After discussing the key ideas behind look-up tables (LUTs) in the previous section, we now
focus on how these LUTs are embedded into coarser architectural units and distributed across
the FPGA fabric.
21
Each LUT is paired with a ip-op, i.e., a 1-bit memory element to store the result of
a table look-up. is facilitates pipelined circuit designs, where signals may propagate through
large parts of the FPGA chip while a high clock frequency is maintained. Next to LUT-based
memories these ip-ops are the second type of memory elements present in FPGAs. Whether
a ip-op is used or by-passed is determined by a multiplexer. e multiplexers in the elementary
logic units can be driven by additional SRAM that is also set when an FPGA is programmed.
Finally, FPGAs have fast dedicated wires between neighboring LUTs and their corresponding circuitry. e most common type of such communication channels are carry chains. Carry
chains allow combining multiple LUTs to implement arithmetic functions such as adders and
multipliers. In Figure 3.3 (left), the blue path represents a carry chain (though somewhat simplied, e.g., wires to the ip-op or output multiplexer have been omitted).
Typically, the vertical wires of the carry chain pass through dedicated carry logic that helps
in the construction of particular arithmetic functions. For example, on the right-hand side of
Figure 3.3, a full adder (1-bit adder) is constructed using an XOR gate (implemented by the LUT)
together with another XOR gate, as well as a 2-to-1 multiplexer of the carry logic. Via the vertical
carry wires a cascade of such full adders can be used to create wider adders.
3.4
ROUTING ARCHITECTURE
Direct wires to neighboring elementary logic units (e.g., carry chains) allow combining multiple
units to build more sophisticated circuits such as adders and multipliers. However, modern FPGAs provide enough congurable resources to host an entire system on chip (SoC). But to build
such a complex system a more exible communication mechanism is required to connect dierent
sub-circuits spread out over the FPGA fabric. is communication mechanism is known as the
interconnect.
3. FPGAS
switch matrix
carry-out
carry-out
elementary
logic unit (2)
logic island
22
elementary
logic unit (1)
.
carry-in
IOB
IOB
IOB
IOB
IOB
LI03
LI13
LI23
LI33
IOB
IOB
LI02
LI12
LI22
LI32
IOB
IOB
LI01
LI11
LI21
LI31
IOB
IOB
LI00
LI10
LI20
LI30
IOB
IOB
IOB
IOB
IOB
carry-in
Figure 3.4: Internals of a logic island (left) and two-dimensional arrangement of logic islands (LIxy s )
on an FPGA (right), surrounded by I/O blocks (IOBs).
segments) away. e interconnect also makes it possible for logic islands to directly communicate
with special I/O blocks (IOBs) located at the periphery of the FPGA (see Section 3.5).
3.4.2 INTERCONNECT
e interconnect is a congurable routing architecture that allows communication between arbitrary logic islands. It consists of communication channels (bundles of wires) that run horizontally
and vertically across the chip, forming a grid containing a logic island in every grid cell.
As illustrated in Figure 3.5, at the intersection points of the routing channels there are
programmable links that determine how the wires are connected, allowing to connect the outputs
and the inputs of arbitrary logic islands or I/O blocks.
Each wire can be connected to any of the other three wires that come together at the intersection point, i.e., all those physical connections exist but programmable switches determine
which connections are active. In the example, in Figure 3.5, a vertical connection (red) was programmed by setting the SRAM cell of the corresponding switch appropriately. Hence, wires can
be programmed to take left or right turns or continue straight.
3.5
HIGH-SPEED I/O
As mentioned in the previous section, the two-dimensional array of logic islands is surrounded by
a large amount of I/O blocks (IOBs). ese IOBs sit at the periphery of the FPGA and are also
programmable
switch matrix and
bundle of lines
programmable link
at intersection point
SRAM
23
cell
programmable
switch with
memory cell
Figure 3.5: Routing architecture with switch matrix, programmable links at intersection points, and
programmable switches.
connected to the programmable interconnect, allowing the logic islands to communicate with the
outside world (cf. Figure 3.4).
Also the IOBs can be programmed to serve dierent needs and allow the FPGA to communicate with a multitude of other devices. Typically, many I/O standards are supported, with the
two main classes of I/O standards being single-ended (used, e.g., in PCI) and for higher performance dierential (used, e.g., in PCI Express, SATA, 10G Ethernet, etc.). Typically, the IOBs
also contain certain auxiliary hardware such as serial-to-parallel converters or 8b/10b encoders/decoders that are used in a number of communication protocols. In a nutshell, the IOBs can be
programmed to implement the physical layer of many common communication schemes.
High-speed (multi-gigabit) I/O is implemented using extremely fast serial transceivers at
the heart of the IOBs. e fastest transceivers, at the time of writing this book, are the GTH/GTZ
type transceivers of the Virtex-7 HT FPGAs from Xilinx, providing 28 Gb/s serial bandwidth
eachby comparison, SATA Gen 3 requires 6 Gb/s serial bandwidth. e Virtex-7 HT FPGA
ships with sixteen 28 Gb/s and seventy-two 13 Gb/s transceivers. us, aggregate bandwidth of
more than a terabit per second can be achieved with these FPGAs.
A transceiver is an electronic device consisting of both a transmitter and a receiver.
24
3. FPGAS
logic island
BRAM
DSP unit
Clock A
Address A
DataIn A
DataOut A
Port A
WriteEn A
Clock B
Address B
DataIn B
DataOut B
Port B
WriteEn B
.
Figure 3.6: FPGA layout with interspersed BRAM blocks and DSP units (left), and the (slightly
simplied) interface of a dual-ported BRAM block (right).
3.6
e logic resources of FPGAs discussed so far are in principle sucient to implement a wide
range of circuits. However, to address high-performance and usability needs of some applications,
FPGA vendors additionally intersperse FPGAs with special silicon components (cf. Figure 3.6)
such as dedicated RAM blocks (BRAM), multipliers and adders (DSP units), and in some cases
even full-edged CPU cores. Hence, Herbordt et al. [2008] observed that the model for FPGAs
has evolved from a bag of gates to a bag of computer parts.
25
On Virtex FPGAs, BRAMs are dual-ported, as depicted on the right-hand side of Figure 3.6. is means that the BRAM can be accessed concurrently by two dierent circuits. e
word width for each port is congurable, i.e., one circuit might choose to access BRAM at a byte
granularity, while another addresses BRAM in four-byte chunks. Each port is driven by a separate clock, i.e., the two circuits accessing the BRAM may run at dierent speeds. Furthermore,
a dual-ported BRAM can be congured to behave as two single-ported BRAMs (each one-half
the original size) or even as FIFO-queues.
BRAMs can be used for clock domain crossing and bus width conversion in an elegant way.
For instance, an Ethernet circuit clocked at 125 MHz could directly write data of received packets
into a BRAM, congured as a FIFO buer, one byte at a time. On the other side, a consuming
circuit with a dierent clock speed, say 200 MHz, could choose to read from that same buer at
a 4-byte granularity.
1 C a2 xn
(where xn/yn indicate the lters input/output values at clock cycle n, respectively).
is lter processes a stream of input samples in a sliding window manner, i.e., the last
three input samples are multiplied by some coecients (a0 , a1 , a2 ) and then accumulated. A
typical (fully pipelined) hardware implementation of such as lter is depicted in Figure 3.7. All
three multiplications and additions are computed in parallel and intermediate results are stored in
ip-op registers (. ). Because this combination of multiply and accumulate (MAC) is so frequently
used in DSP applications, a DSP unit, in essence, usually comprises a multiplier and an adder.
As with most other components in FPGAs, the DSP units can also be customized and
combined with adjacent DSP units. For example, a Xilinx DSP48E slice has three input ports
(which are 25 bits, 18 bits, 48 bits wide) and provides a 25 18-bit multiplier in combination
with a pipelined second stage that can be programmed as 48-bit subtractor or adder with optional
accumulation feedback. Hence, these DSP units can be used in a variety of modes, and perform
operations such as multiply, multiply-and-accumulate, multiply-and-add/subtract, three input
addition, wide bus multiplexing, barrel shifting, etc., on wide inputs in only one or two clock
cycles. In the database context, fast multipliers are very useful, e.g., to implement ecient hash
functions.
26
3. FPGAS
xn .
a2
DSP unit
a1
C
a0
C
yn
Figure 3.7: Fully pipelined FIR lter constructed from three DSP units.
3.7
FPGA PROGRAMMING
Having discussed the key ingredients of FPGAs, we now take a closer look at how FPGAs are
programmed. From a high-level perspective, the FPGA design ow is very similar to generating
hard-wired circuits, which we discussed in the previous chapter (Section 2.3). Its the tools proe PHY connects Ethernet circuitry to a physical medium such as optical ber or copper cable.
Please note that here the Atom processor and the FPGA communicate via PCI Express, i.e., this is more of a system-inpackage than a true system on chip (SoC).
mapped
NCD
routed
BIT
iMPACT
NCD
bitgen
NGD
par
NGC
map
HDL
ngdbuild
XST or other
27
FPGA
.
synthesize
implement design
generate
bitstream
program
FPGA
Figure 3.8: FPGA design ow: Xilinx tool chain and intermediate circuit specication formats.
vided by the FPGA vendors that do all the magic of mapping a generic circuit specication onto
FPGA hardware.
e entry point to programming FPGAs is the same as for producing hard-wired circuits, i.e.,
typically by using a hardware description language (HDL) such as VHDL or Verilog. e Xilinx synthesizer (XST) turns an HDL specication into a collection of gate-level netlists (native
generic circuit (NGC) format), mapped to a technology library (UNISIM) provided by Xilinx.
However, at this level also third-party synthesizers (e.g., Synplicity) may be used, which typically
store the netlist using an industry-standard EDIF format.
Translate
e tool ngdbuild combines and translates all input netlists and constraints into a single netlist
saved as native generic database (NGD) le. e FPGA designer species constraints in a socalled user constraint le (UCF). Constraints are used to assign special physical elements of the
FPGA (e.g., I/O pins, clocks, etc.) to ports of modules in the design, as well as to specify timing
requirements of the design. Whereas the NGC netlist is based on the UNISIM library for behavioral simulation, the NGD netlist is based on the SIMPRIM library, which also allows timing
simulation.
EDIF stands for electronic design interchange format.
28
3. FPGAS
Map
e map tool maps the SIMPRIM primitives in an NGD netlist to specic device resources such
as logic islands, I/O blocks, BRAM blocks, etc. e map tool then generates a native circuit
description (NCD) le that describes the circuit, now mapped to physical FPGA components.
Notice that this is an additional step not needed in the classical design ow for generating circuits
(cf. Section 2.3).
Place and Route
Placement and routing is performed by the par tool. e physical elements specied in the NCD
le are placed at precise locations on the FPGA chip and interconnected. While doing so, par takes
timing constraints specied in the user constraint le (UCF) into account. Oftentimes, place and
route (based on simulated annealing algorithms) is the most time consuming step in the design
ow, and multiple iterations may be necessary to comply with all timing constraints. e par tool
takes the mapped NCD le and generates a routed NCD le, which also contains the routing
information.
Bitstream Generation and Device Programming
Now the routed design needs to be loaded onto the FPGA. However, the design must rst be
converted into an FPGA-readable format. is is handled by the bitgen tool, which encodes the
design into a binary, known as bitstream. e bitstream can then be loaded onto the FPGA, e.g.,
via JTAG cable and using the iMPACT tool. As a side note, modern FPGAs often also feature
the possibility to encrypt and authenticate bitstreams to support security-sensitive applications.
e bitstream controls a nite state machine inside the FPGA, which extracts conguration
data from the bitstream and block-wise loads it into the FPGA chip. Xilinx calls these blocks
frames. Each frame is stored in a designated location in the conguration SRAM that directly
relates to a physical site on the FPGA (cf. Figure 3.9) and congures the various congurable
elements on that site, e.g., multiplexers, inverters, dierent types of LUTs, and other conguration
parameters. Once the conguration memory is completely written, the FPGA is programmed and
ready for operation.
DSP frame
row n - 2
row n - 1
row n
logic frame
29
FPGA
static region
partially reconfigurable
region A
partially reconfigurable
region B
partial
partial
partial
partial
bitstream
bitstream
bitstream
bitstream
A1
A2
B1
B2
in Virtex-4, Virtex-5, and Virtex-6 FPGAs a CLB-frame (i.e., for logic island conguration)
spans 16 1, 20 1, and 40 1 CLBs, respectively.
e organization of conguration memory described above is the basis for a technique
known as dynamic partial reconguration. is technique allows parts of an FPGA to be reprogrammed without interrupting other running parts on the same FPGA. To do so, only the frames
of a particular partial reconguration region (PRR) are updated with a new conguration, while
the other frames are left unchanged.
Dynamic partial reconguration enables interesting applications, where specialized modules can be loaded on-demand at run time without occupying precious chip space when they are
inactive. To load a hardware module, a control unit on the FPGA (e.g., a processor) loads conguration data from some external sourcefor example, from o-chip DRAMand sends it to
the so-called Internal Conguration Access Port (ICAP), which is the gateway to the conguration
memory of the FPGA.
e above scenario is illustrated on the right-hand side of Figure 3.9. Notice that xed
partially recongurable regions (PRRs) need to be dened beforehand, i.e., when the static part
of a circuit is designed. ose regions then serve as placeholders, into which a bitstream can be
loaded later on. A partial bitstream can be only loaded into the exact PRR that it was designed for,
Note that Xilinx has a longer history of supporting dynamic partial reconguration in their FPGAs than Altera, which is why
in this section we use Xilinx-specic terminology and focus on the design ow for Xilinx devices.
30
3. FPGAS
28 nm FPGA die
silicon interposer
.
package substrate
solder balls
e.g., in the example the partial bitstream A1 could not be loaded into the partially recongurable
region B. is can be a limitation, hence partial bitstream relocation is an active research topic
studied, e.g., in the work of Touiza et al. [2012].
Nevertheless, state-of-the-art dynamic partial reconguration already exhibits signicant
benets, for example: (i) time-multiplexed applications may use more circuitry than actually ts
onto a single FPGA, (ii) there is no idle power consumed by the circuits not currently in use,
(iii) and design productivity can be increased since synthesizing smaller partial bitstreams is a lot
faster than full bitstreams synthesis.
3.8
After having discussed established core FPGA technology, in this section, we look into what
is currently happening at the forefront of FPGA research and innovation. We selected a few
topics ranging from FPGA manufacturing and FPGA architecture to how FPGAs could be programmed in the future.
31
side by side on top of the so-called silicon interposer. e interposer is a passive silicon chip
that connects adjacent FPGA dies via tens of thousands of connections, allowing for very high
bandwidth, low latency, and low power consumption. Note that side by side stacking avoids a
number of thermal issues that could result from stacking multiple FPGA dies on top of each
other.
32
3. FPGAS
Tabula refers to this concept as 3-dimensional chips of eight folds, where logic elements
not only connect to adjacent logic elements in the two-dimensional space, as in traditional FPGA
architectures, but also to logic cells in the above fold. is is made possible using transparent
latches in the interconnect, which are controlled by time-multiplexing circuitry, and allow communication between dierent folds.
e ABAX chip can be programmed exactly the same way as one would program a commodity FPGA, i.e., the high-speed reconguration and time-multiplexing is completely hidden
from the programmer. e key advantage of this technology is that it can provide the same amount
of logic resources as large commodity FPGAs, however, at a signicantly lower price, i.e., in the
range of 100-200 USD. Hence, the technology is very promising. As a result, Tabula was ranked
third on the Wall Streets Journals annual Next Big ing list in 2012 [Basich and Maltby,
2012].
33
CHAPTER
4.1
FPGAs provide the opportunity to modify and re-congure the FPGA at a very ne granularity,
even from one user query to the next. We will, in fact, discuss some systems that follow this
route later in Chapter 5. e strategy is not appropriate for all application scenarios, however.
e problem is that circuit (re-)compilation is an extremely CPU-intensive operation. Necessary
steps, such as component placement and routing are highly compute-intensive, and they scale
poorly with the circuit size. In practice, several minutes of compilation are the norm; some circuits
might require hours to be generated.
On the positive side, circuit re-building has the potential to generate highly ecient (if not
optimal) circuits for a very wide range of problem instances. Eectively, system designers face
three design goals:
(a) Runtime Performance. At runtime, the hardware solution should have good performance characteristics. Ideally, these characteristics should be close to those of a hand-crafted, tailor-made
circuit for the problem instance at hand.
(b) Flexibility/Expressiveness. e solution should support a wide range of problem instances.
SQL, for instance, is expressive enough to cover many useful applications.
34
runtime
performance
.
exibility/
expressiveness
re-conguration
speed
Figure 4.1: Design space for FPGA programming model. Design goals are execution performance
at runtime; exibility/expressiveness to support dierent problem instances; and a fast way to realize
workload changes. Not all goals can be maximized at the same time.
(c) Re-Conguration Speed. When workloads change, the hardware solution should be able to
react to such changes with low latency. To illustrate, having to wait for minute- or hour-long
circuit routing is certainly inappropriate for ad hoc query processing.
Unfortunately, not all of these goals can be reached at the same time. Rather, designers have to
make compromises between the opposing goals. As illustrated with Figure 4.1, at most two goals
can be met satisfactoryat the expense of the third.
runtime perf.
.
exibility
re-conf. speed
e re-compilation eort can be reduced through the use of pre-compiled modules that the circuit
generator merely stitches together to obtain a working hardware solution for a given problem
Note that circuit re-compilation is a software-only task. e FPGA must be taken o-line only to upload the compiled
bitstream. is time is relatively short and technology exists to eliminate it altogether (using multi-context FPGAs).
35
instance. e system of Dennl et al. [2012], for instance, includes modules for relational algebra
operators that can be used to construct a physical representation of an algebraic query plan on the
two-dimensional chip space.
Pre-compiled modules work well together with partial reconguration, selective replacement of only some areas on the
runtime perf.
FPGA chip (cf. Section 3.7.2). And when these areas are small,
also less time is needed to move the (partial) bitstream to the
device, which may further improve responsiveness to workload
.
changes.
Only so much variety can be pre-compiled, however, which
limits the exibility that can be achieved by following this route. In exibility re-conf. speed
our three-goal design space, this moves the approach toward faster
re-conguration speed, but at the expense of exibility (illustrated
on the right). Pre-compiled modules and partial re-conguration can also be combined with
parameterization to improve the exibility/performance trade-o. We will look at this technique
in a moment.
At this point we would like to mention that circuit re-construction is not only computeintensive. It also implies that, at application runtime, a stack of hardware design tools has to be
executed for synthesis, placement/routing, and bitstream generation. Installation, maintenance,
and licensing of these tools might be too complex and expensive to employ the approach in practical settings. If used with partial re-conguration, pre-compiled modules might not actually depend on the availability of these tools. But partial re-conguration has yet to prove its maturity
practical use. Most commercial users would likely refrain from using the technology today in
real-world settings.
36
.
disk
memory
DMA
. compress
project
CPU
restrict
FPGA
Figure 4.2: Data ow in the Netezza FAST engine (adapted from Francisco [2011]).
Parameterization can actually be quite powerful. Its potential reaches far beyond only the setting
of selection parameters or column names. e approach is expressive enough to cover a large and,
most importantly, relevant subset of XPath, the de facto standard to access XML data [Teubner
et al., 2012]. Pushing this subset to an accelerator may speed up, e.g., an in-memory XQuery
processor by large factors.
XPath can be implemented with help of nite-state automata, driven by the sequence of
opening and closing tags in the XML input. e structure of these automata depends on the user
query. e relevant insight now is that the class of automata that can arise is constrained by the
XPath language specication. is constraint is sucient to build a skeleton automaton that includes any transition edge that could be expressed with XPath. By making the condition assigned
to each of these edges a conguration parameter, the skeleton automaton can be parameterized
37
skeleton automaton
XPath
spec.
.
:::
a
?
a
?
:::
b
*
:::
FPGA
conguration param.
Figure 4.3: Parameterization oers excellent runtime and re-conguration performance, but limits
the expressiveness addressable by the hardware accelerator. Skeleton automata illustrate how a meaningful class of queries can be supported nevertheless. Edges of a general-purpose state automaton (the
skeleton automaton) can be parameterized to describe any relevant query automaton.
to run any XPath query (within the relevant dialect) as a true hardware NFA. Transitions not
needed for a particular query can be assigned a false condition parameter, eectively removing
the transition from the automaton.
Figure 4.3 illustrates this concept. e skeleton automaton is generated based on the language semantics of XPath and uploaded to the FPGA once. e user query is then used to infer
conguration parameters (printed blue in Figure 4.3), which are used to ll placeholders (indicated as in Figure 4.3) in the hardware circuit. Conguration parameters can be inferred and
installed in a micro-second time scale, which guarantees full ad hoc query capabilities.
38
4.2
e true potential of FPGA technology lies, of course, in the ability to create tailor-made circuits
for a given application problem. But how can such circuit be inferred from a problem specication?
39
the present operator input, but not on, e.g., previously seen input items. at is, combinational
circuits describe pure functions. Combinational circuits can be wired up into larger combinational
circuits simply according to the data ow of the functions that they describe. e operation
y D f g.x1 / ; h.x2 /
could thus be implemented as the circuit
x2
x1
y.
where f. indicates the sub-circuit that implements f . By construction, this leads to directed
acyclic graphs/circuits.
Some application problems require access to previous values from the input and/or from the
output. If we use xk to denote the value of an (input) item x at clock cycle k , the two examples
yk D
xk
1 C xk
2
(A)
yk D yk
(S)
1 C xk
would access values from the preceding clock cycle to compute the average value of the last two
x seen and the running sum of all x , respectively.
To implement such behavior, memory elementsip-op registers in practicemust be
inserted into the data path(s) of the circuit. A register, indicated as rectangles . as before, briey
stores the value that it receives at its input and makes it available on its output during the next
clock cycle. e above two examples can then be expressed in hardware as follows:
x
1=.2
.
x
Observe how, in both cases, registers delay values by one clock cycles. To access even older
items, multiple delay registers can be used one after another.
40
For functions that require delay functionality, the circuit must be explicitly synchronized to
a clock signal in the VHDL/Verilog code. If a (sub-)result must be carried from one clock cycle
to the next (i.e., delayed) that result must explicitly be assigned to a register variable or signal.
Design tools will, however, try to eliminate redundant registers. ey will often also try to retime the resulting circuit: pushing combinatorial tasks before or after a delay register may help to
balance signal delay paths and thus improve the maximum propagation delay, which is one of the
key determinant for the circuits speed.
Circuits generated this way typically serve as an entry point for further tuning. In particular,
those circuits might have long and poorly balanced signal paths (despite automatic re-timing).
And they do not leverage parallelism, which is a key strength of tailor-made hardware. In the section that follows, we will thus discuss how circuits can be optimized by exploiting data parallelism
and pipeline parallelism (the latter also leads to optimized signal paths). But before that, we will
have a very brief look at high-level synthesis tools.
BB1
sum
0
i
0
BB2 tmp
sum
0
for i D 0 to 7 do
sum
sum C read ()
end for
write (sum)
41
read ()
sum
sum C tmp
BB3 i D i C 1
branch to BB2 if i < 8
BB4 write (sum)
Figure 4.4: To compile high-level language code, Optimus [Hormati et al., 2008] breaks down user
code into basic blocks and annotates data ow and control ow information. After mapping all basic
blocks to hardware, their control and data ports are wired according to the control and data ow
information. Illustration adapted from [Hormati et al., 2008].
joint research project of U Cambridge and Microsoft Research [Greaves and Singh, 2008], uses
custom attributes to .NET assembly to achieve the same goal.
e Accelerator platform makes the interplay of language expressiveness and parallelism on
dierent hardware back-ends explicit. In the context of .NET, Accelerator describes a functionalstyle framework to express data-parallel programs. A set of back-end compilers can then generate runnable code for a wide range of data-parallel hardware, including commodity processors,
graphics processors, and FPGAs (the latter has been demonstrated by Singh [2011]).
4.3
DATA-PARALLEL APPROACHES
e strength of FPGAs (or any other bare-hardware platform) lies in their inherent hardware
parallelism. Fundamentally, any single gate, any sub-circuit, or any sub-area on the chip die can
operate independently of any other. is massive potential for parallelism is only limited by explicit synchronization or serialization, which the circuit designer chose to dene to match the
semantics of the application scenario.
In practice, application circuits do need a fair degree of synchronization. But hardware
allows such synchronization to be lightweight and very ecient. is is in sharp contrast to
heavyweight mechanisms (compare and swap or even just memory ordering), which programhttp://research.microsoft.com/en-us/projects/Accelerator/
42
mers should avoid in software-based systems if they aim for performance. is capability for
lightweight synchronization is also the reason why we are particularly interested in ne-grained
parallelism in this chapter and look at task assignment on the level of assembly style microoperations.
Types of Parallelism. e available hardware parallelism can be applied to application problems
in many dierent ways. In the context of FPGAs and tailor-made circuits, two strategies have
been by far the most successful, and we will discuss them in turn. In this section, we rst look at
ne-grained data parallelism, which has many similarities to software techniques like vectorization
or partition/replicate schemes. Section 4.4 then looks at pipeline parallelism, which in hardware
is a lot more appealing than it typically is in software.
collect
dispatch
43
Besides availability of chip space, the practical limit to replication is the speed at which data
can be provided to the circuit and/or results consumed at the output of the circuit. For instance,
if data arrive as a single, sequential input stream, dissecting this stream into independent work
units often bottlenecks data-parallel execution.
4.4
PIPELINE-PARALLEL APPROACHES
Pipeline parallelism is a form of task parallelism and applies to situations where a given task f
can be broken down into a sequence sub-tasks f1 ; : : : ; fp , such that f D fp f1 . e subtasks f1 ; : : : ; fp can then be computed on separate processing units, and intermediate results are
forwarded from unit to unit (or pipeline stage to pipeline stage). e concept is similar to an
assembly line in, say, a car factory. And like in a car factory, the concept becomes highly parallel if
multiple data items ow through the pipeline one after another; all processing units then operate
in parallel, each one on a dierent input item.
At the logical level, pipelining is a frequent pattern in many software systems. e execution
engines of most database systems, for instance, are built on the concept and evaluate query plans
in a pipeline model. Physically, however, those systems use pipelining only rarely. e cost of
messaging between physical processing units is often prohibitive; forwarding database tuples,
e.g., between processor cores would dominate the overall execution cost.
f.1
f2
f3
To compute the fi independent of one another (and thus allow for parallelism), as a next
step we need to introduce pipeline registers. To this end, we insert a ip-op on any signal path
from fi to fiC1 , as indicated here using gray bars:
f.1
f2
f3
throughput
44
replication
combined
q D 13
p D 10
qD2
p D 100
p D 50
p D 10
p D 20
pipelining
qD7
qD4
pD4
pD2
pD1
q D 10
qD1
qD2
area
Figure 4.6: Eects of replication and pipelining on processing throughput of an example circuit. For
this graph, we modeled an example circuit along the lines of Kaeslin [2008]. Notice that the location
of, e.g., crossover points may depend on the particular circuit.
e eect of these registers is that they remember the outcome of computation fi , such that in
the following clock cycle they appear as a stable signal to the input of fiC1 . e circuit for fi then
becomes available again to accept the next item from its input.
us, the modied circuit could still accept a new input item on every clock cycle (like the
original circuit f could). But the introduction of pipeline registers reduced the longest signal path
of the circuit, which is now the longest path of any fi . Assuming that f could be broken into subcircuits of equal size, this means that the clock frequency can be increased by approximately a factor
of p (the pipeline depth). e increased clock frequency directly translates into a throughput
increase.
Cost of Pipelining. Pipelining is attractive in hardware, because the introduction of pipeline
registers causes only a small overhead, both in terms of space and performance. Notice in particular that we only had to introduce new registers; there was no need to replicate or expand the
combinational part of the circuit, however. Pipelining reaches its limit when the signal delay for
a single fi approaches the speed of the associated pipeline register.
is can be seen in Figure 4.6. In this gure, we illustrated how replication/data parallelism
and pipelining can turn additional chip area into increased throughput. To obtain the graph, we
assumed characteristics of a typical hardware circuit and idealized models for the eects of replication and pipelining, as detailed by Kaeslin [2008]. e graph shows how, initially, pipelining
requires little investment (some ip-ops only) to gain substantial throughput improvements. e
intrinsic latency of pipeline registers, however, limits the throughput that can be achieved with
pipelining alone.
45
In practice, replication and pipelining are often used in combination. To illustrate, we included an example where the (pipelined) circuit with p D 10 is replicated on the chip, which for
the example results in an additional performance boost.
Wiring Overhead. e simple model used to generate Figure 4.6 does not include any overhead
that may result from wiring and communication needs. If replication is used excessively, however,
this overhead may become signicant in practice, whereas pipeline parallelism tends to be less
aected by wiring costs. is dierence can be understood from the graphical representation that
we showed above for both approaches. As the degree of parallelism increases replicated circuits
will range over an increasing area of the chip die. us, dispatch and collect circuits at both ends
have to bridge an increasing distance as q grows, which directly aects signal path lengths. is
problem does not arise for pipeline parallelism, where communication remains short-ranged no
matter how large the parallelism degree.
A practical example of how pipelining may actually help to avoid
large fan-outs and long signal paths is the XML ltering engine that
.
:::
we showed earlier in Figure 4.3. Its actual implementation (detailed in
[Teubner et al., 2012]) uses pipeline registers in-between segments of
the state automaton circuit, as illustrated here on the right (Figure 4.7).
e design avoids that the input stream must be supplied to all automa- Figure 4.7: Pipelining
ton transitions in parallel, which would scale poorly as the number of and skeleton automata
segments increases. is keeps throughput rates high, even when the [Teubner et al., 2012].
length and complexity of the matching automaton increases [Teubner
et al., 2012].
46
the same line of work, Yang et al. [2008] also bounded signal paths and fan-outs through pipelining (Figure 5.8).
sum
sum C tmp
Pipeline registers in-between the two sub-operations would enable the loop body to be processed in parallel. In practice, operations like x 2 can be pipelined internally, increasing parallelism
and speed even further.
Example: Pipeline-Parallel Frequent Item Computation
Arguably, the above example could be replaced by a parallel computation of partial sums, followed
by a merging operation. e attractiveness of pipelining comes from the fact that also much more
intricate application problems can be accelerated through pipeline parallelism. To illustrate this,
consider the Space-Saving algorithm of Metwally et al. [2006], shown as Algorithm 1. To answer
top-k -type queries, Space-Saving counts the number of occurrences of items xi in a data stream.
Space-Saving is an approximate algorithm with bounded space (n bins, item/count pairs).
Space-Saving not only contains loop-carried dependencies (via count and item values). It
also requires accessing the same memory content according to dierent criteria (item lookups and
search for the bin with the minimum count value), which has made the algorithm notoriously
hard to parallelize through classical means. In fact, the parallel solution of Das et al. [2009] has a
lower throughput than the single-threaded code of Cormode and Hadjieleftheriou [2008], who
did an in-depth study and comparison of frequent item counting techniques.
Pipeline parallelism can help to signicantly speed up Space-Saving on FPGA hardware [Teubner et al., 2011]. e idea is a combination of classical pipeline parallelismlet input
items x ow through a sequence of hardware-based binsand a neighbor-to-neighbor communication mechanism between bins. e concept is illustrated in Figure 4.8. Items xj travel along
47
xj
xj
item
count
1 bi :item D x1
bi
item
count
item
count
bi
biC1
item
count
biC2
48
125
pipeline-parallel
100
75
50
data-parallel
25
0
16
32
64
128
256
512
1024
number of items monitored (degree of parallelism)
Figure 4.9: FPGA-based solutions to the frequent item problem. e pipeline-parallel strategy of
Figure 4.8 keeps wire lengths short and scales signicantly better than a data-parallel alternative (data
from [Teubner et al., 2011]).
a cut will keep the semantics of the circuit intact; results will only be delayed by one additional
clock cycle.
If the data ow contains cyclesthat is, if the output of a previous computation is needed
to process the next input itemsuch cuts may no longer be found, and the intuitive approach to
pipelining no longer be successful. It turns out, however, that many forms of such recursive circuits
can still be pipelined. A good starting point to get to a pipelined solution is to partially unroll the
iterative computation. Depending on additional properties, such as associativity of operations, the
unrolled circuit can then often be re-organized such that cuts in the above sense can be found.
A detailed discussion is beyond the scope of this book and we refer to Section 2.7 in the book of
Kaeslin [2008] for details.
4.5
RELATED CONCEPTS
In many ways, FPGAs are probably the most exible type of compute resources available today.
As such, they cover a very large design space in terms of their system design and integration
and in terms of how they exploit hardware parallelism, which has become the key approach to
performance in virtually any computing device.
Several specic points in this design space are also covered by o-the-shelf hardware devices
that may be usable as accelerators, co-processors, or even standalone processors. Probably the most
well-known representatives of such a device are graphics processors (GPUs), which meanwhile have
evolved into computing platforms with a remarkably wide range of applications.
49
Graphics Processors (GPUs). Graphics processing units make data parallelism explicit at a scale
unmatched by any other processor technology. e latest incarnation of the NVIDIA Kepler architecture, for instance, includes up to 15 SMX Streaming Multiprocessors [Corp., 2012]. Each
of them contains 192 cores (which in general-purpose CPU terminology would best compare
to an ALU), for a total of 2,880 parallel processing units. ereby, the granularity of data parallelism sits in-between the replicated parallel circuits that we discussed in Section 4.3 and the
course-grained parallelism available in general-purpose multi-core processors. NVIDIA GPUs
follow an SIMT (single instruction, multiple threads) execution model: groups of 32 threads
(a warp) are scheduled such that all 32 threads execute the same instruction at the same time.
is signicantly eases hardware scheduling logic and brings intrinsic data parallelism all the way
down to the execution layer.
At the programmers level, the graphics device can execute compute kernels. Many thousands, even millions or more, logical executions of such a kernel operate on independent data
items. ereby, synchronization across threads is highly limited, which again simplies the underlying hardware and enables higher compute density.
Graphics processors were identied as a potential substrate for database co-processing almost a decade ago. Govindaraju et al. [2004] showedeven before graphics processors oered
the programmability that they have todaythat the available data parallelism can be used to speed
up important database tasks, such as selection and aggregation. Two years later, Govindaraju et al.
[2006] showed how the use of a GPU co-processor can oer signicant performance/price advantages when implementing sorting. He et al. [2008] pushed the idea of using graphics processors
for database co-processing one step further by running database joins on GPU hardware.
Many-Core Processors. Inspired by graphics processor designs, other processor makers have
come up with acceleration platforms that emphasize data parallelism on the hardware level. Intel
has recently announced their Xeon Phi platform [Intel Corp., 2012], which packages 60 generalpurpose cores, each capable of executing four threads, into a single chip. Internally, each core
oers a 512-bit-wide SIMD unit for vector-oriented execution. While the processing model of
Xeon Phi is not strictly tied to data-parallel execution, its NUMA (non-uniform memory access)
architecture clearly favors data-parallel tasks.
Data Flow Computing on FPGAs. For reasons mentioned in this chapter, FPGAs are very attractive to leverage pipeline parallelism (and accelerate application tasks that can benet less from
data parallelism alone). Several vendors make this explicit in FPGA programming platforms. For
instance, Maxeler oers platforms for dataow computing [Pell and Averbukh, 2012]. A dedicated compiler extracts data ow information from a Java program. e resulting data ow graph
is then mapped to an FPGA circuit design that is highly susceptible to pipeline parallelism. Processing pipelines created this way may span entire FPGA chip dies and use thousands of pipeline
stages.
51
CHAPTER
5.1
Matching an input data stream to a (set of ) regular expression(s) is an important and useful task
on its own, but also as a pre-processing step for many stream analysis tasks. For instance, it is the
task of a network intrusion detection system to detect suspicious patterns in a network data ow
and perform a series of actions when a match is detected (e.g., alert users or block network trac).
Semantically rich stream processing engines depend on parsing and value extraction from their
input stream to perform higher-level computations.
Regular expressions correspond 1-to-1 to nite-state automata, which are the method of
choice to realize pattern matching in both hard- and software. eir low-level implementation
faces considerably dierent trade-os in hard- and software. By studying these trade-os, in
the following we illustrate some of the important characteristics of FPGA hardware and their
consequences on real-world applications.
52
a
q.0
b
q1
a
q2
c
q3
q4
q5
*
nite-state automaton (NFA). at is, multiple states in this automaton might be active at a time
(e.g., after reading a single a, states q0 and q1 are both active) and multiple transitions may have
to be followed for a single input symbol.
A beauty of non-deterministic automata lies in their easy derivation from regular expressions. Simple, syntax-driven construction rulesmost well known are those of McNaughton and
Yamada [1960] and ompson [1968]allow to mechanically convert any regular pattern into an
equivalent NFA. is simplicity is the reason why in Figure 5.1, the original pattern .*abac.*d
still shines through. For similar reasons, such non-deterministic automata are attractive in many
application scenarios, because new patterns can easily be added (or old ones removed) from an
existing automaton.
Deterministic and Non-Deterministic Automata
In practice, many states in QD can be determined statically to be unreachable, so the actual number of states jQD j is typically
N
less than 2jQ j .
53
a
a
def
def
def
def
b
d
d
def
def
Figure 5.2: Deterministic automaton, equivalent to the non-deterministic automaton in Figure 5.1.
e automaton contains more states, but now only one of them can be active at a time.
input D a
q0
OR
FF
input D b
q1
AND
FF
input D c
input D d
q2
AND
FF
q3
AND
OR
FF
q4
AND
FF
.
Figure 5.3: Hardware implementation for the non-deterministic automaton in Figure 5.1. Each state
qi maps to a ip-op register; each transition maps to combinational logic between states.
2. For each transition qi ! qj , instantiate combinational logic that forwards an active bit from
FFi to FFj if the condition p is satised. If the new content of FFj has multiple sources,
combine them with a logical OR.
Applying this strategy to the automaton in Figure 5.1 results in the hardware logic shown
in Figure 5.3. Observe how the construction preserves the structure of the source automaton and
how states/transitions map to ip-ops/combinational logic.
54
LUT consumption in %
An automaton can be mapped into hardware with this strategy whether the automaton is
deterministic or not. e ineciency that arises in software implementationsiterative processing of candidate statesdoes not apply to this hardware solution. All logic resources in an FPGA
chip operate independently, so possible transitions are naturally considered in parallel.
6
NFA
DFA (one-hot encoded)
DFA (binary encoded)
5
4
3
2
1
0 .
0
4 5 6 7 8
i in (0|1)* 1 (0|1)i
10
Figure 5.4: FPGA resource consumption (lookup tables) for automaton alternatives. DFAs can be
encoded with one bit per state (one-hot) or by enumerating all states and encoding them in a binary
number.
In fact, when implemented in hardware, non-deterministic automata are often the strategy
of choice. In addition to the advantages already mentioned above (correspondence with regular
expressions allows for easy construction or modication), NFAs tend to have a much simpler
structure. is makes the combinational logic to implement transitions simpler and more ecient. In Figure 5.4, we illustrated the FPGA resource demand for dierent implementation
strategies for the same regular expression (Xilinx Virtex-5 LX110T chip). Consumption of logic
resources is an important criterion in FPGA design on its own. Here the growing logic complexity may additionally lead to longer signal propagation delays, reduced clock frequencies, and
lower overall performance.
Nj
a
q0.
q1
q0.
q2
b q3
q2
d
a
c
c
55
q5
q1
b
(a) Simplied NFA to match the regular expression
b*c(a|b)*d.
Figure 5.5: Rewriting nite-state automata for better FPGA resource utilization. Both automata recognize the same language, but the right one maps better to FPGA primitives.
::
:
.
OR
AND
FF
input D x
Figure 5.6: Once NFAs are in proper shape (cf. Figure 5.5(b)), they can be realized just with the
single type of module shown as (a). Figure (b) illustrates the resulting implementation of b*c(a|b)*d
(where abbreviates an OR gate and stands for an AND gate).
(5.1)
Figure 5.5 illustrates this with two automata for the regular expression b*c(a|b)*d. Intuitively, the automaton in Figure 5.5(a) has lower resource consumption. But the alternative in
56
Figure 5.5(b) satises the constraint of having just one input symbol at the incoming transitions
of each automaton state. Automata that adhere to this shape can be realized in hardware with
just a single type of module. Such a module is shown in Figure 5.6(a) (assuming an n-ary OR gate
to accommodate ingoing transitions and an AND gate to account for the condition). As Yang and
Prasanna [2012] have shown, the combinational parts of this circuit map well to a combination
of lookup tables, which are readily paired with a ip-op in modern FPGAs. Figure 5.6(b) shows
how modules can be assembled to implement the automaton shown in Figure 5.5(b).
(5.2)
state
Q.
logic
input xi
Actual intrusion detection systems will have to match the input network stream against hundreds,
if not thousands, of rules. With the amount of chip space available in modern FPGAs, all state
match out
reg
reg
RE5
RE6
RE7
RE8
reg
RE13
RE14
RE15
RE16
reg
reg
input
57
reg
RE1
RE2
RE3
RE4
reg
RE9
RE10
RE11
RE12
.
Figure 5.8: Pipeline registers (indicated as reg
. ) help to keep signal propagation delays low and avoid
high-fanout signals (illustration adapted from Yang et al. [2008]).
automata to match such large rule sets can be laid out side-by-side on the two-dimensional chip
area. anks to the intrinsic parallelism, all rules can then be matched fully in parallel, promising
high, rule set-independent matching speed.
In practice, however, such perfect scaling is limited by geometrical and physical eects.
As the rule set grows, the generated automata will cover a growing area on the chip, causing
the distance between components to increase (following an O.N / dependence, where N is the
number of NFAs). is, in turn, increases signal propagation delays in the generated circuit, such
that the clock frequency (and thus the achievable throughput) has to be reduced to maintain correct
behavior of the hardware circuit.
A solution to this problem is pipelining. ereby, signal paths are intercepted by pipeline
registers, which memorize their input signals from one clock cycle to the next. With shorter signal
paths, clock frequencies can be increased, with direct consequences on the observed throughput.
e price for this is a slight increase in latency. In an n-staged pipeline, the overall circuit output
(in this case a match information) is delayed by n FPGA clock cycles.
For the problem at hand, pipelining can be applied in a hierarchical fashion, as illustrated in
Figure 5.8. As can be seen in the gure, this keeps the number of stages (intuitively, the number of
pipeline registers along any path from the circuit input to its output) short, while still allowing for
a large rule set. In practice, clock cycle times are in the range 510 ns, such that pipelining causes
only negligible latency overhead (e.g., compared to the time the same packet needs to travel over
the network wire).
58
raw
stream
event
.
extraction
(NFA-based)
events
stream
partitioning
(state memory)
event
old
new
state
pattern
matcher
(NFA-based)
match
Figure 5.9: Complex event processing architecture. Events are extracted from raw input stream. A
partitioner component reads the corresponding state for each input event, hands it to an NFA-based
pattern matcher, then memorizes the new partition state.
Space $ roughput
Multi-character matching and pipelining both trade chip resources for better matching throughput. As a third space $ throughput trade-o, the entire matching logic can be replicated on
the chip, with incoming network packets load-balanced to either of the replicas. In practice, all
three strategies form a design space, and it depends on the hardware and problem characteristic, which combination of strategies maximizes the overall matching throughput. For a rule set of
760 patterns from the SNORT intrusion detection system, Yang et al. [2008] report an achievable
throughput of 14.4 Gb/s on a Virtex-4 LX100 FPGA device (this chip was released in 2004).
5.2
As described above, nite-state automata allow the detection of symbol sequences in a single input
data stream. is model is adequate, e.g., to perform syntactic analyses on the stream or to match
patterns within a single message (as is the case in the above intrusion detection scenario). e true
strength of modern stream processing engines, however, comes from lifting pattern matching to
a higher semantical level. To this end, low-level events are derived from the input stream (e.g.,
through syntactic analyses). e resulting sequence of events is then analyzed according to complex
event patterns. As an example, a stock broker might want to be informed whenever the price for
any stock symbol has seen ve or more upward movements, then a downward change (pattern
up{5} down, where up and down are derived events).
e challenge in matching complex event patterns is that they usually depend on semantic
partitioning of the input events. For instance, prices for various stock symbols might arrive interleaved with one another; a matching pattern for one stock symbol might overlap with many
(partial) matches for other symbols. To detect such patterns, the stream processor needs to keep
track of the matching state for each of the stock symbols in the stream.
input
hMSFT; 42i
events
YHOO
hGOOG; 17i
FB
hAAPL; 29i
GOOG
AAPL
59
to
matcher
old
new
.
Figure 5.10: Hardware-based stream partitioning using a chain of hgroup-id; state-veci pairs. e
strategy keeps signal paths short and the design scalable.
e resulting architecture is illustrated in Figure 5.9. An NFA-based syntax analyzer extracts low-level events from the raw input stream (e.g., a network byte stream, as used for click
stream analysis in [Woods et al., 2011]). A hardware stream partitioner uses the partitioning criterion in each event (e.g., a stock symbol or a client IP address) to read out the current vector
of states from a local state memory. State vector and source event are then routed to the actual
pattern matcher which will (a) report eventual matches to the outside and (b) send an updated
state vector back to the partitioner component.
60
12
120
100
80
basic events
60
40
% packets processed
% processed
10
20
input packets
.
1
10
20
30
40
50
60
basic events per packet
70
80
90
Figure 5.11: Complex event processing in hardware guarantees line-rate performance, independent
of how events are packeted on the network wire. Results taken from Woods et al. [2011].
61
e hardware partitioning mechanism illustrated above was shown to guarantee such linerate performance, as illustrated in Figure 5.11. Software-based alternatives are often very sensitive
to the way events are presented at the input of the system. If events are sent as very small Ethernet
packets, for instance, most software solutions become overloaded because of their high per-packet
processing overhead. As the gure shows, hardware-accelerated complex event processing is not
sensitive to this problem and guarantees 100 % line rate performance independent of event packeting.
5.3
Up until now we had looked at the FPGA as an isolated component. It would listen to an incoming stream, but we left unspecied what kind of output or action is being generated by the
programmable hardware. In practice, most applications will be too complex to be solved entirely
in FPGA hardware, which suggests hybrid FPGA/CPU processing to jointly solve the application
task. Ideally, a hybrid system design would also allow for a transition path, where performancecritical functionality is o-loaded one-by-one without major disruptions on the user-level interface.
A system architecture that can satisfy all these criteria is when the FPGA is plugged into
the data path of the processing engine:
source
.
ltered
raw data
CPU
FPGA
data
In such an architecture, the FPGA consumes the raw input datausually high-volumeand
applies ltering or other pre-processing steps that reduce the volume of data. e remaining lowvolume data set is forwarded to a conventional CPU, where, for instance, it could be fed into the
processing pipeline of an existing system. A practical example of this model could be an FPGA
that applies selection and projection to a large data set while it is read from a hard disk (i.e.,
source disk). Netezza commercialized this concept in their Netezza Performance Server (NPS)
system.
A data path architecture elegantly separates the application task to match the strengths of
both parts of an FPGA/CPU hybrid. FPGAs are extremely good when the task to perform is
relatively simple, but the data volume is huge. Conversely, sophisticated control logic in generalpurpose processors makes them very ecient at complex operations; but their I/O capabilities
and their energy eciency fall way behind those of modern FPGA devices.
62
systems need to sift through large amounts of dynamic data, but typically only few events are
actually relevant for further processing. High expectations toward ad hoc querying force data
analytics engines to execute most of their work as brute force scans over large data volumes (Unterbrunner et al. [2009] describe a ight booking system as a concrete example).
Electronic stock trading is a prototype example of how FPGAs can signicantly accelerate
existing application systems or even enable new market opportunities that will remain hard to
address with software-only solutions even in upcoming CPU architectures. e challenge here
is a very high input data volume, combined with uniquely tight latency requirements. Any improvement in latencyon a micro-second scale!will bring a competitive advantage that may be
worth millions of dollars [Schneider, 2012].
High-Frequency Trading. In high-frequency trading, stock traders monitor market price information. Automated systems buy or sell stocks within fractions of a milli-second to, e.g., benet
from arbitrage eects. ese systems usually focus on a very particular market segment, stock
symbol, or class of shares. If the input stream from the stock markettypically a high-volume
stream with information about a large market subsetis pre-processed on an FPGA and with
negligible latency, the core trading system can focus just on the relevant parts of the market, with
lower latency and better forecasting precision.
Risk Management. In response to incidents on the stock market, where erroneous trades by
automated systems have led to severe market disruptions (e.g., the May 6, 2010 Flash Crash or
a technology breakdown at Knight Capital Group on August 1, 2012), the American SEC began
to impose risk management controls on stock brokers. Today, any broker with direct market access
has to sanity-check all orders sent to the stock market to prevent unintended large-scale stock
orders (SEC Rule 15c3-5).
Software alone would not be able to evaluate all SEC criteria without adding signicant
latency to the trading process. But if the control program listens in to the trading stream through
an FPGA with pre-processing capabilities, risk evaluation can be performed with a latency of only
a micro-second or less [Lockwood et al., 2012].
5.4
For certain application areaswe discussed network monitoring and electronic stock trading
hereFPGAs oer signicant advantages in terms of performance, but also in terms of their
energy eciency. Ideally, these advantages would carry over to more general cases of stream or
database processing.
is is exactly the goal of the Glacier system [Mueller et al., 2009, 2010]. Glacier is a compiler that can translate queries from a dialect of SQL into the VHDL description of an equivalent
hardware circuit. is circuit, when loaded into an FPGA, implements the given query in hardware and at a guaranteed throughput rate.
63
Table 5.1: Streaming algebra supported by the Glacier SQL-to-hardware compiler (a; b; c : eld
names; q; qi : sub-plans; x : parameterized sub-plan input). Taken from [Mueller et al., 2009].
operator
a1 ;:::;an .q/
a .q/
? aW.b1 ;b2 / .q/
q1 [ q2
aggbWa .q/
q1 grpxjc q2 .x/
q1 txjk;l q2 .x/
q1 . q2
semantics
projection
select tuples where eld a contains true
arithmetic/Boolean operation a D b1 ? b2
union
aggregate agg using input eld a, agg 2 favg; count; max; min; sumg
group output of q1 by eld c , then
invoke q2 with x substituted by the group
sliding window with size k , advance by l ; apply q2 with x substituted
on each window; t 2 ftime; tupleg: time- or tuple-based
concatenation; position-based eld join
.
tuple
xj4;1
SELECT avg (Price) AS avgprice
FROM (SELECT * . FROM Trades
WHERE Symbol = "UBSN")
[ SIZE 4 ADVANCE 1 TUPLES ]
(a) Example sliding-window query.
a
avgavgpriceW.Price/
D aW.Symbol;"UBSN"/
Trades
(b) Corresponding algebra plan.
Figure 5.12: Query compilation in Glacier. Streaming SQL queries are converted into an algebraic
representation, then compiled into a hardware circuit.
e heart of the Glacier compiler operates on a streaming algebra that assumes tuplestructured input events. is algebra, shown in Table 5.1, is sucient to express particularly those
aspects of a user query that can be realized as a pre-processing step in the sense of the data path
architecture discussed above. Operators can be nested arbitrarily. Following the usual design of a
database-style query processor, SQL queries stated by the user are rst converted into an internal
algebraic form, then translated to VHDL code. Figure 5.12 illustrates an example adapted from
Mueller et al. [2009] and its corresponding algebraic plan.
64
data_
valid
&
a .q/
a
q
Z)
.
a1 an
q
Figure 5.14: Glacier compilation rules for selection (left) and projection (right).
Glacier -generated hardware execution plans follow a strictly push-based execution strategy. at
is, individual sub-plans write their output into a single register set, from where they assume an
upstream operator will pick up the result immediately in the next clock cycle.
Such a strategy is adequate for execution in hardware, because a circuits runtime characteristics can be inferred statically at circuit generation time with very high accuracy. More specifNote that in the Glacier algebra, operates on Boolean columns only. Complex selection criteria must be made explicit by
applying, e.g., arithmetic or Boolean operations beforehand.
65
ically, the latency, i.e., the number of clock cycles needed by an operator to present the result of
a computation at its output port, and the issue rate, i.e., the minimum gap (in clock cycles) between two successive tuples pushed into an operator, are precisely dened by the structure of the
hardware circuit. Glacier submits the generated hardware description together with the desired
clock frequency (e.g., sucient to meet the line rate of a network data stream) to the FPGA tool
chain, which will verify that the generated circuit can meet the frequency requirements. If a circuit cannot meet its requested throughput rate, the situation will be detected at compile time and
the user demand rejected by the Glacier system.
For most query types, Glacier can maintain an issue rate of one tuple per clock cycle [Mueller et al., 2009] (which in practice signicantly eases timing and interfacing with the
respective stream source). Typical queries roughly compile into a pipeline-style query plan, which
means that the latency of the generated plan depends linearly on the query complexity. In practice, the resulting latencies are rarely a concern; for clock frequencies of 100200 MHz, a few
cycles (typically less than a hundred) still result in a latency of less than a micro-second.
Resource Management
Glacier draws its predictable runtime performance from statically allocating all hardware resources
at circuit compilation time. Each operator instance, for example, receives its dedicated chip area
and no resources are shared between operators. In eect, the compiler lays out a hardware plan
on the two-dimensional chip space with a structure that resembles the shape of the input algebra
plan. Processed data ows through this plan, resulting in a truly pipelined query execution.
Resource management becomes an issue mainly in the context of stateful operators such as
grouping (aggregation) or windowing. Glacier assumes that the necessary state for such operations
can be determined at query compilation time (e.g., with knowledge about group cardinalities or
from the combination of window and slide sizes in the case of windowing operators). Glacier then
replicates dependent sub-plans and produces a dispatch logic that routes tuples to any involved
replica.
Figure 5.15 illustrates this mechanism for the query shown earlier in Figure 5.12. e botD combination (this part will
tom part of this generated hardware execution plan reects the -
result in strictly pipelined processing). e upper part contains ve replicas of the avg sub-plan
(the windowing clause 4; 1 allows at most four windows to be open at any time) and dispatch
logic to drive them. For windowing operators, the dispatch logic consists of cyclic shift registers
(CSRs) that let windows open and close according to the windowing clause given.
In the case of windowing clauses, Glacier will route tuples to sub-circuits for all active windows and typically many of them are active at a time. For grouping operations, by contrast, tuples
must be routed to exactly one group. Glacier still uses circuit replication to represent grouping in
hardware (and a content-addressable memory (CAM) to look up matching groups). If replicaGlacier does allow a restricted form of multi-query optimization. Because of the strictly push-based processing model, identical
sub-plans can be shared across queries.
66
5-way union
0
eos
&
&
0
eos
avgprc
avg
&
&
1
eos
avgprc
avg
&
eos
avgprc
avg
CSR2
&
CSR1
counter
.
&
adv
avgprc
avg
&
eos
&
&
avgprc
avg
&
a
a
Symbol
a
D
"UBSN"
Trades
D aW.Symbol;"UBSN"/
Figure 5.15: Hardware execution plan for the query in Figure 5.12(a). Glacier replicates the sub-plan
of the windowing operator . A combination of two cyclic shift registers (CSR) routes tuples to the
right replica(s). Illustration adapted from [Mueller et al., 2009].
tion is not desirable (or not feasible, e.g., because of hardware resource constraints), the hardware
partitioning mechanism discussed in Section 5.2.2 could be used to memorize group states and
create only one circuit instance to serve all groups.
Hash Tables in Hardware. For even larger groups, circuits may have to resort to external memory to keep group states. A hash table would be the obvious choice for a data structure for this
purpose. e crux of hashing is, however, its unpredictable performance. Hash collisions may
require multiple round trips to memory, leading to a response time dependence on key distributions.
Kirsch and Mitzenmacher [2010] describe and analyze hashing schemes for hardware implementations. If used correctly, multiple-choice hashing schemes can signicantly reduce the probability of hash collisions. And once collisions have become very rare (Kirsch and Mitzenmacher
[2010] report probabilities below one in a million entries), a small content-addressable memory
(CAM), installed side-by-side to the hash table, is enough to capture them. is way, predictable
performance can be achieved with minimal hardware resource consumption.
In multiple-choice hashing schemes, every key has multiple locations where it could be
placed in memory. Cuckoo hashing [Pagh and Rodler, 2001] is a known software technique based
on multiple-choice hashing to guarantee constant-time lookups. When realized in hardware, all
67
possible locations of an entry can be tested in parallel, hence avoiding one of the down sides of
multiple-choice hashing.
glue .logic
(de-serialize)
internal
format
hardware
query plan
internal
format
glue logic
(serialize)
external
format
FPGA
Incoming data is being de-serialized to the internal format of the hardware execution plan. e
produced query output is brought into an external wire format before it leaves the FPGA chip
again.
Observe how glue logic usually requires some additional chip area. Interfacing with outside
data formats does not, however, usually lead to a noticeable runtime overhead on the query processing task. Assuming that glue logic components can keep up with the stream data rates, they
cooperate with the hardware plan in a pipelining fashion. e additional latency (order of a few
FPGA cycles) is typically negligible.
Implementing a de-serialization component can be a tedious task. Conceptually, it resembles the writing of a software parser. But unlike in the software world, very few tools (such as
(f)lex or JLex for C/Java) exist to generate hardware parsers from high-level language specications. One tool to generate VHDL code from regular language grammars is Snowfall [Teubner
and Woods, 2011]. Similar in spirit to compiler generators for software parsers, Snowfall allows
a grammar specication to be annotated with action code. At runtime, this action code may, for
instance, drive signal wires depending on the syntactical structure of the input stream.
As in the software domain, serializing the output of a query processor into an application format usually amounts to a sequential program (implemented via a small, sequential state
machine) that emits eld values as required by the format.
5.5
All of the systems and strategies discussed above assume a processing model that is illustrated in
Figure 5.16 (assuming the Glacier query compiler). In this model, a query compiler generates a
description for a dedicated hardware circuit (e.g., using VHDL) that implements the input query.
68
user
.
query
Glacier
compiler
VHDL
code
FPGA
tools
bitstream
FPGA
chip
Figure 5.16: Processing model for FPGA-accelerated query processing. A query-to-hardware compiler (e.g., Glacier ) compiles the user query into a circuit description. Standard FPGA design tools
generate a bitstream from that, which is uploaded to the FPGA chip.
FPGA design tools, such as Xilinx ISE convert this description into a runnable bitstream that is
uploaded to the FPGA for execution.
Intuitively, this model oers high exibility, allows maximum performance (by fully retailoring the chip for every workload change), and leverages the re-programming capabilities
of FPGA devices in a meaningful way. is intuition, however, is overshadowed by a massive
compilation overhead that the approach brings. e conversion of high-level circuit descriptions
into a runnable bitstream is highly compute intensive; the vpr program in the SPEC CPU2000
benchmark suite even uses the place & route task to measure CPU performance. By comparison,
compilation to VHDL and re-conguration of the FPGA can be performed quickly.
69
b.3
a3
op1
op2
op3
d2
c2
b2
a2
d1 :
(e illustration assumes an execution plan of three operators. e rst of them is just seeing the
last attribute of tuple t2 .) In this representation, the port width between neighboring components
is constant and tuples of arbitrary width could be processed.
Conguring Modules. Minimal compilation cost is achieved by using pre-compiled modules to
instantiate the opi in the above illustration. To guarantee the necessary exibility, most modules
will be generic operators that can be parameterized to t the particular operator requirements
and the given input/output tuple schemata. In the implementation of Dennl et al. [2012], conguration parameters are communicated over the same data path as the payload data. Additional
handshake signals ensure that both uses are handled as appropriate.
A particular conguration parameter are tuple eld names where hardware operators read
their input from or, equivalently, the chunk index where the respective eld can be found within
the input stream. For operator results (e.g., the outcome of an arithmetic or Boolean operation),
Dennl et al. [2012] use an in-band transfer mechanism; results are simply written into available
chunks of the data stream. To make this possible, the input data stream is interspersed with spare
chunks that can be used for that purpose.
Runtime Reconguration. Once the interfaces between hardware components are xed, the
mix & match idea of Dennl et al. [2012] may even be used in combination with partial reconguration. With some restrictions, this feature of modern FPGA chips allows us to swap sub-circuits
of a larger hardware design in and out at runtime. Such a strategy is best suited if multiple queries
are run concurrently on a single FPGA chip. Queries can then be added/removed from the chip
without a need to stop running queries for the reconguration.
e price to pay for the partial reconguration capability is that the size of all components
must t the granularity of a reconguration frame (a device-specic value; 20/40 congurable
logic blocks for Xilinx Virtex-5/6 devices). According to Dennl et al. [2012], this overhead is
bearable and amounts to about 30 % lost chip space.
5.6
BIBLIOGRAPHIC NOTES
FPGAs have been used for regular expression matching in a number of scenarios. Clark and
Schimmel [2004] suggested their use for network packet analysis. Mitra et al. [2009] showed
how XML publish/subscribe systems could be accelerated with FPGA-based pattern matching.
Later, they rened their approach to handle a larger class of twig-based XML patterns [Moussalli
et al., 2011]. Sadoghi et al. [2011] used FPGAs for a very similar application scenario, but their
70
system is not based on state automata and regular expression matching. Rather, they break down
their input data into attribute/value pairs and match them through their Propagation algorithm.
Vaidya et al. [2010] extended the Borealis stream processing engine [Abadi et al., 2005] and
accelerated a use case where trac information obtained through a video channel is pre-processed
using dedicated image processing logic on the FPGA. e design of this Symbiote system is such
that partial or entire plan trees can be migrated to the FPGA or handled on the CPU.
e data path concept of Section 5.3 resembles the idea of database machines. In this line
of research, various groups built special-purpose hardware that could pre-lter data as it is being
read from persistent storage. Most notable here is the D engine of DeWitt [1979].
Outside the database and stream processing world, researchers have very successfully used
FPGAs in, e.g., scientic applications. e use of FGPAs at CERNs Large Hadron Collider
(LHC) essentially follows the data path architecture that we looked at on page 61. Data rates
of several terabits per second, produced by the particle accelerator, are way above what could
be processed and archived on commodity hardware. us, FPGA-based triggers pre-analyze the
high-volume input stream, so only relevant information gets forwarded to the main processing
ow. Gregerson et al. [2009] illustrate this for (parts of ) the Compact Muon Solenoid (CMS)
Trigger at CERN. ere, an FPGA-based lter reduces a 3 Tb/s input stream to manageable
100 Mb/s.
71
CHAPTER
Accelerated DB Operators
In the previous chapter, we illustrated various ways of applying FPGAs to stream processing
applications. In this chapter, we illustrate that FPGAs also have the potential to accelerate more
classical data processing tasks by exploiting various forms of parallelism inherent to FPGAs. In
particular, we will discuss FPGA-acceleration for two dierent database operators (i) sort and (ii)
skyline.
6.1
SORT OPERATOR
Sorting is a fundamental operation in any database management system. Various other database
operators such as joins or GROUP BY aggregation can be implemented eciently when input
tuples to these operators are sorted. However, sorting is a rather expensive operation that can
easily become the bottleneck in a query plan. Hence, accelerating sorting can have great impact
on overall query processing performance in a database. In this section, we will discuss a number
of dierent approaches to sort small as well as large problem sets with FPGAs.
72
6. ACCELERATED
. DB OPERATORS
1
3
2
8
2
7
5
6
4
6
6
7
5
6
x1
y0
x2
y1
x3
y2
x4
y3
x5
y4
x6
y5
x7
y6
x8
y7
Figure 6.2: Fully pipelined even-odd sorting network with six pipeline stages.
be swapped: (3,1) ! (1,3). After all values have propagated through all the compare-and-swap
elements they appear in sorted order at the output of the circuit, i.e., the smallest value is at the
topmost output and the largest value appears at the bottom output.
ere are several ways that compare-and-swap elements can be arranged to build a sorting network. e arrangement shown here is known as even-odd sorting network. Mueller et al.
[2012] also discuss other sorting networks in detail such as bitonic sorting networks or networks
based on bubble sort. Dierent arrangements of the compare-and-swap elements mostly aect resource consumption and ease of implementation, and we will not discuss them any further here.
One problem with the circuit depicted in Figure 6.1 is that the longest signal path has to
traverse six compare-and-swap elements. e maximum clock frequency at which a circuit can be
clocked is determined by the longest signal path of a circuit. By inserting pipeline registers into the
circuit the longest signal path can be shortened. In Figure 6.2, we illustrate such pipeline registers
sorted runs
73
merged run
0
1
select-value component
Figure 6.3: Select-value component merges two sorted runs into a larger sorted run.
.
with gray boxes. With the pipeline registers in place, every signal now only needs to traverse one
compare-and-swap element to the next pipeline register. At every clock tick, intermediate states
are stored in the pipeline registers, allowing the circuit to partially process six dierent data sets
concurrently in six dierent stages.
Mueller et al. [2012] report that a similar pipelined circuit to the one shown in Figure 6.2
could be clocked at fclk D 267 MHz. Since the circuit processes 8 32 bits per clock cycle, a data
processing rate of 8.5 GB/s was achieved. A sorting network with twice as many inputs (i.e., 16
32-bit words) at the same clock rate would double the throughput. However, it quickly becomes
dicult to move data in and out of the FPGA at these high processing rates and the complexity
of the sorting circuits exponentially increases with more inputs. us, sorting networks are a very
ecient way to sort small sets of values that could be used, e.g., to implemented a hardware
accelerated sort instruction of a closely coupled microprocessor to sort SIMD registers.
74
6. ACCELERATED DB OPERATORS
>
>
0
1
1
2
>
0
1
1
2
0
1
Figure 6.4: A cascade of FIFO merge sorters used to produce large sorted runs.
.
FIFO. en the next value is requested from the input FIFO that has submitted the smaller
value. Figure 6.4 shows how a cascade of such merge sorters can be combined to create larger and
larger sorted runs. e output of the select-value component is directed to a rst output FIFO
until it is lled and then redirected to a second output FIFO. ose output FIFOs then serve as
inputs to the next select-value component.
Koch and Torresen [2011] observed that at each stage, processing can start after the rst
input FIFO has been lled and the rst value of the second FIFO arrives. Furthermore, the selectvalue component always only reads from one of the two input FIFOs and the result is written to
only one of the two output FIFOs. Hence, the overall ll level of the FIFOs is constant. erefore,
the second FIFO is not strictly necessary. Koch and Torresen [2011] showed how to get rid of
the second FIFO. To do so, however, they had to build a custom FIFO based on a linked list
structure to deal with the two read and two write pointers within a single FIFO.
Koch and Torresen [2011] evaluated the FIFO merge sorter described above. Using 98% of
the available BRAM it was possible to sort 43,000 64-bit keys (344 KB) in a single iteration, i.e.,
by streaming the keys through the FPGA once. e circuit could be clocked at fclk D 252 MHz
resulting in a throughput of 2 GB/s.
75
memory
load unit
host
FIFO
merge
sorter
tree
merge
sorter
Figure 6.5: Tree merge sorter (left), and a combination of a FIFO merge sorter with a tree merge
sorter connected to external DRAM (right).
On the right-hand-side of Figure 6.5 a combination of the FIFO merge sorter, described
in the previous section, and a tree merge sorter is illustrated. In a rst step, unsorted data is
streamed through the FIFO merge sorter on the FPGA, which generates initial runs that are
stored in external DRAM. en these runs are read back from DRAM and merged by a tree
merge sorter before the nal result is sent back to the host. If the data set is so large that one
pass through the tree merge sorter is not enough then multiple round trips to DRAM would be
necessary.
Koch and Torresen [2011] report that the tree-merge-sorter achieved a throughput of
1 GB/s on their FPGA, and could merge up to 4.39 million keys (35.1 MB) in one pass. However,
this measurement assumes that the entire FPGA can be used for merging. For a conguration
like the one in Figure 6.5 on the right, where both a FIFO merge sorter and a tree merge sorter
need to t on the same FPGA 1,08 million keys (8.6 MB) could be sorted at a throughput of
1 GB/s.
76
6. ACCELERATED DB OPERATORS
memory
host
dynamic partial
reconfiguration
FIFO
merge
sorter
host
memory
tree
merge
sorter
Figure 6.6: Using dynamic partial reconguration to rst run the FIFO merge sorter and then the
tree merge sorter in the same partially recongurable region.
6.2
SKYLINE OPERATOR
Skyline queries compute the Pareto-optimal set of multi-dimensional data points. ey are a good
example of a complex database task that can greatly benet from FPGA acceleration due to their
compute-intensive nature, especially when dealing with higher dimensions. Formally, the skyline
of a set of multi-dimensional data points is dened as follows:
A tuple ti dominates () another tuple tj i every dimension of ti is better than
or equal to the corresponding dimension of tj and at least one dimension of ti is strictly better than
the corresponding dimension of tj .
Denition 6.1
Denition 6.2 Given a set of input tuples I D ft1 ; t2 ; : : : tn g, the skyline query returns a set of
tuples S , such that any tuple ti 2 S is not dominated by any other tuple tj 2 I .
Here, better means either smaller or larger depending on the query.
else if qi pj then
window.drop(pj );
/* pj is dominated by qi */
else if pj qi then
isDominated D true;
break;
/* qi is dominated by pj */
else
window.insert(qi );
77
Figure 6.7: Standard Block Nested Loops (BNL) Algorithm ( means dominates).
78
6. ACCELERATED DB OPERATORS
n-dimensional tuple
PE 0
message channels
PE 1
PE 2
Figure 6.8: Window tuples (consisting of several dimensions) are distributed over a pipeline of processing elements. Neighboring processing elements are connected via 32-bit message channels.
it either encounters the rst tuple qj from the input queue that has a larger timestamp or when
the input queue is empty. A larger timestamp indicates that two tuples must have already been
compared and since the queue is totally ordered, all following tuples in the queue will also have
larger timestamps. e algorithm terminates when the input queue is empty.
In BNL, each input tuple needs to be compared against all potential skyline tuples stored in the
window. is is an expensive process since the window may consist of several hundred tuples. To
achieve high throughput only a minimal number of clock cycles should be spent on each input
tuple before the next tuple is read from the queue. us, Woods et al. [2013] propose to distribute
the window of potential skyline tuples over a pipeline of daisy-chained processing elements, as
illustrated in Figure 6.8.
A processing element stores a single tuple of the window. An input tuple is submitted to the
rst processing element in the pipeline from where it is forwarded to the neighboring processing
element after evaluation via the specied message channel. us, w processing elements operate
on the window concurrently such that w dominance tests are performed in parallel, where w is
the size of the window.
Causality Guarantees
e processing elements are organized in a way that input tuples are evaluated in a strictly feedforward oriented way. is has important consequences that can be exploited in order to parallelize
the execution over many processing elements while preserving the causality of the corresponding
sequential algorithm.
xj
?
.
PE d
79
xi
?
PE h
Figure 6.9: Causality guarantees. e earlier xi will see no eects caused by the later xj but xj sees
all eects of xi .
Feed-forward processing implies that the global working set is scanned exactly once in a
dened order. What is more, once an input tuple xi has reached a processing element h , its evaluation cannot be aected by any later input tuple xj that is evaluated over a preceding processing
element d (conversely, the later xj is guaranteed to see all eects caused by the earlier xi ).
ese causality guarantees hold even if we let the executions of xi on h and xj on d
run in parallel on independent compute resources, as illustrated in Figure 6.9. For example, once
an input tuple xi reaches the last processing element, it can safely be assumed that it has been
compared against all other working set tuples and appropriate actions can be invoked.
Parallel BNL as Two-Phase Algorithm
In summary, the parallel version of BNL works as follows. Input tuples propagate through the
pipeline of processing elements and are evaluated against a dierent window tuple at every stage
in the pipeline. If at one point an input tuple is dominated, a ag is set that propagates through
the pipeline together with every tuple. On the other hand, if a window tuple is dominated it is
deleted. When an input tuple reaches the last processing element, and was not dominated by any
window tuple (indicated by the domination ag), the tuple is timestamped and then inserted into
the window if there is space, or written back to DRAM otherwise. Notice that new potential
skyline tuples can only be inserted into the window at the last processing element to ensure that
they have been compared to all existing window tuples. is means that free slots in the window
that occur when window tuples are dominated need to propagate toward the end of the pipeline.
To enforce this, neighboring processing elements can swap their contents.
e processing elements execute the algorithm just described in two phases: (i) an evaluation phase and (ii) a shift phase. During the evaluation phase, a new state is determined for each
processing element; but these changes are not applied before the shift phase, which is the phase that
allows nearest neighbor communication. ose two phases run synchronously across the FPGA,
as depicted in Figure 6.10.
80
6. ACCELERATED DB OPERATORS
eval.
shift
eval.
shift
eval.
shift
eval.
shift
eval.
shift
throughput (tuples/sec)
Figure 6.10: Two-phase processing in parallel BNL. Circles represent processing elements. A processing element consists of logic, storage for the window tuple, and communication channels to neighboring processing elements.
109
BNL Software
BNL FPGA
108
CPU
FPGA
107
. 0
41 M tuples/sec
25 ms exec. time
17 M tuples/sec
61 ms exec. time
8
16 32 64 128 256
window size : number of tuples
Figure 6.11: Correlated dimensions resulting in a small skyline. Performance is memory bound.
single-threaded software implementation, as well as a state-of-the-art multi-threaded skyline implementation [Park et al., 2009]. As we will discuss, the comparisons with the single-threaded
software implementation (Figure 6.11 and Figure 6.12) highlight several fundamental dierences
between CPUs and FPGAs.
For their experiments, Woods et al. [2013] use data sets with common data distributions to
evaluate skyline computation. Figure 6.11 shows the results for a data set, where the dimensions of
the tuples are correlated. is means that the values in all dimensions of a tuple are similar resulting
in very few skyline tuples that dominate all other tuples. As can been seen in the gure, both
implementations achieve a throughput that is close to the maximum possible throughput given
by the memory subsystem (dashed lines). e CPU achieves better performance here because it
has the more ecient memory subsystem. e total number of dominance tests is very low, i.e.,
essentially what is measured is how fast main memory can be read/written on the given platform.
By contrast, the results displayed in Figure 6.12 for a data set where the dimensions of the
tuples are anti-correlated, present the two implementations in a dierent light. Anti-correlated
means that tuples with high values in some dimensions are likely to have low values in other
throughput (tuples/sec)
105
BNL Software
BNL FPGA
81
32 K tuples/sec
32 sec exec. time
104
103
. 0
1.8 K tuples/sec
579 sec exec. time
8
16 32 64 128 256
window size : number of tuples
Figure 6.12: Anti-correlated dimensions resulting in a large skyline. Performance is compute bound.
dimensions, i.e., there are many incomparable tuples leading to many dominance tests. Hence,
skyline computation is now heavily compute-bound.
For the software variant, increasing the window size has little eect on throughput because
the number of total dominance tests stays roughly the same independent of the window size. For
the FPGA implementation, on the other hand, increasing the window means adding processing
elements, i.e., compute resources, which is why throughput increases linearly with the window
size.
Notice that the computation of the skyline for the anti-correlated data set is signicantly
more expensive, e.g., the best execution time of the CPU-based version has gone from 18 milliseconds to almost 10 minutes. is slowdown is due to the increased number of comparisons
since all skyline tuples have to be pairwise compared with each other. us, the workloads where
the FPGA excels are also the ones where acceleration is needed most.
As mentioned previously, Woods et al. [2013] also compared their implementation against
PSkyline [Park et al., 2009], a state-of-the-art parallel skyline operator for multicores. e performance achieved with a low-end FPGA was comparable to the one of PSkyline on a 64-core Dell
PowerEdge Server using 64 threads. However, notice that there is a signicant dierence in price
(FPGA = $750 versus Dell = $12,000), as well as power consumption between the two systems.
Moreover, with 192 processing elements a throughput of 32,000 tuples/sec (anti-correlated distribution) is reached on the FPGA. is is more than two orders of magnitude below the upper
bound of 17 million tuples/sec (cf. Figure 6.11), i.e., with a larger FPGA, there is still a lot of
leeway to further increase performance by adding more processing elements.
Two tuples are incomparable if neither tuple dominates the other one.
FPGAs use between one and two orders of magnitude less power than CPUs.
83
CHAPTER
7.1
CPU-based systems are typically very complex, both in respect to hardware and software. is
means that there are many possibilities for attacks, i.e., bugs in the operating system, the device
drivers, the compiler, hardware components, etc., can all be exploited to attack the system, and
as a result it is very dicult to make such systems secure. FPGAs have a much smaller attack
surface.
84
cryptographic keys. Together with the BIOS, the TPM chip provides a root of trust that can
be used for authenticated boot. However, one limitation of this approach is that while software is
authenticated when loaded, there is no protection against modication of the code at runtime.
Circuits running on an FPGA are much more dicult to tamper with, especially if the security
features that we will discuss in Section 7.3 are enabled.
Another limitation is that the TPM chip cannot do encryption/decryption on its own. It
can only transfer the cryptographic keys to a region in memory, which the BIOS is supposed to
protect. Encryption/decryption are then performed by the processor. However, the BIOS cannot
always protect main memory, e.g., with physical access to a computer an attacker can retrieve
the encryption keys from a running operating system with a so-called cold boot attack. is is an
attack that relies on the fact that DRAM contents are still readable for a short period of time
after power supply has been removed. In Section 7.4, we will discuss how FPGAs can be used
as secure cryptoprocessors capable of encrypting/decrypting data, such that plaintext data never
leave the chip.
7.2
With respect to protecting intellectual property, FPGAs have an important advantage over
ASICs. If circuit designer and circuit manufacturer are two dierent parties, then the designer
needs to provide the manufacturer with the sensitive circuit description. In fact, very few companies such as Samsung or IBM design circuits and also own high-end semiconductor foundries
to produce them. Most semiconductor companies are fabless. FPGAs allow a company to benet
from the latest manufacturing technology while keeping their circuit designs fully condential.
Another threat to which ASICs are susceptible is destructive analysis, where each layer of the
device is captured to determine its functionality. is technique is not applicable to determining
the functionality of the circuit loaded onto an FPGA since the entire circuit specication is stored
in on-chip conguration memory, i.e., there are no physical wires and gates of such a circuit that
can be analyzed.
While circuits running on FPGAs are better protected than ASICs against reverse engineering threats as the ones described above, FPGAs exhibit other vulnerabilities. For example, by
intercepting the bitstream during conguration of an FPGA the design could relatively easily be
cloned or tampered with. In the next section, we discuss common mechanisms that guard FPGAs
from such and other attacks.
7.3
FPGAs provide a number of security features to protect intellectual property (i.e., the circuit
specication uploaded to the FPGA) from reverse engineering, tampering, and counterfeiting. In
this section, we highlight the most important security-related features of modern FPGAs.
85
86
7.4
e Cipherbase system [Arasu et al., 2013] extends Microsofts SQL Server with customized
trusted hardware built using FPGAs. e project targets data condentiality in the cloud. Cloud
computing oers several advantages that make it attractive for companies to outsource data processing to the cloud. However, a major concern is processing sensitive data. Companies might
not trust a cloud provider to keep their data condential. In fact, in some cases a company might
even want to protect highly condential data from its own employees.
trusted
hardware
FPGA
EncryptedAES (A+B)
87
Table 7.1: Typical plaintext operations and corresponding primitives to execute the same operations
on ciphertext via FPGA.
Plaintext Operation
AD5
ACB
hash
ADB
sum.B/
Index lookup
Range lock
We can distinguish several forms of hybrid data processing in Cipherbase, meaning that
some parts of the processing are handled on commodity hardware while other parts are executed
in the secure environment on the FPGA. First of all, users can specify the level of condentiality
guarantees at a column granularity. For example, when processing employee records, the salary
eld might require strong condentiality guarantees while employer address might not. Hence,
columns and tables that have no condentiality restrictions will not be processed by the trusted
hardware, allowing for a more ecient execution.
Furthermore, even individual operators can be broken down into the parts that need to
be executed by the cryptoprocessor and others that can be handled unprotected by the standard
database software. For instance, consider (B-tree) index processing, where a condential column
is indexed. Searching within an index page requires decrypting condential keys, i.e., needs to be
executed by the cryptoprocessor. On the other hand, many other index operations such as concurrency control, buer pool management, recovery, etc., can be handled outside the crpytoprocesor.
Since FPGA and host system are tightly coupled, a few primitives (cf. Table 7.1) that can be
called from the host system and are implemented on the FPGA are sucient to extend a complete
database system to support fully homomorphic encryption, as described above. Table 7.1 shows
how primitives for decryption (Dec./), encryption (Enc./), and expression evaluation are invoked
by the host system to execute a given operation on encrypted data. Coming back to our index
processing example, for each index page the FindPos./ primitive would be called to determine the
next page to visit. All other indexing logicwith the exception of checking key range lockscan
be handled by the standard database software running on the host.
88
Id
1
2
3
4
5
Instruction
GetData $0
Decrypt
GetData $1
Decrypt
Compare
89
CHAPTER
Conclusions
Almost 50 years have passed since Gordon Moore observed that the number of transistors per
integrated chip would double approximately every 2 years. roughout these years, hardware technology followed the exponential growth with remarkable precision, and there is no indication that
the trend will change any time soon.
e consequences of Moores Law on chip technology, however, have changed dramatically
over time. As already sketched in Chapter 1, Moores Lawin combination with Dennard scaling allowed to drive up clock frequencies and micro-architecture sophistication for many years.
Power constraints set an end to this approach some ten years ago and hardware designers started
to focus on multi-core architectures instead: additional transistors oered by Moores Law were now
turned into replicated on-chip processors (cores).
Multi-core computing never solved the power consumption problem, however. At best, the
now-prevalent way of leveraging hardware parallelism can be considered a temporary mechanism
to mitigate the fundamental problem. A one-to-one conversion of Moores dividend into additional CPU cores would incur an exponentially growing power consumption. But todays chips
already operate at the limit in terms of heat dissipation and cooling.
90
8. CONCLUSIONS
e Deus Ex Machina Horseman. ere might be an entirely unforeseen escape to the power
limitation, e.g., by leveraging technologies other than the current MOSFET. However,
waiting for miracles in the future can hardly be considered a strategy for problems that
applications are suering already today.
In this solution space, FPGAs could be considered a variation of the specialized horseman.
But by contrast to the strategy in Taylors narrow sense, an FPGA-based realization avoids the
need to decide on a set of specialized units at chip design time. Rather, new or improved specialized units could be added to the portfolio of the system at any time. At the same time, no chip
resources are wasted for specialized functionality that a particular system installation may never
actually need (e.g., a machine purely used as a database server will hardly benet from an on-chip
H 264 video decoder).
91
OPEN CHALLENGES
Under these premises, we expect the relevance of FPGAs in computing systems to increase in
the coming years. Hardware makers already demonstrated various ways to integrate congurable
logic with commodity CPUs. Hybrid chipswhere CPU(s) and congurable logic sit on the
same dieare available today, commercially and at volume.
It is thus no longer a question whether or not FPGAs will appear in (mainstream) computing systems. Rather, the database community should begin to worry about how the potential
of FPGAs can be leveraged to improve performance and/or energy eciency.
Tools and Libraries Several decades of research and development work have matured the software world to a degree that virtually any application eld receives a rich set of support by tools,
programming languages, libraries, but also design patterns and good practices. Hardware development is signicantly more complex and has not yet reached the degree of convenience that
software developers have long become used to.
FPGA development still has a rather steep learning curve and many software people shy
away from the technology, because they cannot see the quick progress that they are used to from
their home eld. is is unfortunate not only because the potential of FPGA technologyonce
the entrance fee has been paidis high, but also because hardware/software co-design has so far
mostly been left to the hardware community. Clearly, the concept could benet a lot from experience and technology (e.g., in software compilers, to name just one) that have become ubiquitous
in the software world.
Systems Architectures As discussed in Chapter 4, the nal word on what is the best system
architecture for hybrid CPU/FPGA processing has not yet been spoken. Moreover, data processing
engines would likely benet also from even more classes of modern system technology, including
graphics processors (GPUs), massively parallel processor arrays (MPPAs) [Butts, 2007], or smart
memories [Mai et al., 2000]. However, only small spots in the large space of possible system
architectures have been explored, yet.
Finding a system architecture that brings together the potential of hardware and the requirements of (database) applications requires a fair amount of experimentation, systems building, and evaluation. Early resultssome of which we also sketched in this bookare promising.
But they also still show rough edges that need to be ironed out before they become attractive for
practical use.
92
8. CONCLUSIONS
FPGAs as a Technology Enabler Specialization and the use of FPGAs is often seen as a mechanism to improve quantitative properties of a data processing engine, e.g., its throughput, its
latency, or its energy eciency.
In Chapter 7, we showed that there are also scenarios where FPGAs can act as an enabler
for functionality that cannot be matched with commodity hardware. With their outstanding exibility, FPGAs might serve as an enabler also in further ways. For instance, placing congurable
logic into the network fabric or near storage modules might open new opportunities that cannot
be realized by conventional means.
Flexibility vs. Performance In Chapter 4, we discussed trade-os between runtime performance,
exibility, and re-conguration speed in FPGA designs. Circuit and systems design in general
face very similar trade-os.
General-purpose CPUs were always designed for exibility, with application performance
or energy eciency only as secondary goals. ese priorities are necessary with a technology and
a market where one size must t all.
Designers of FPGA circuits, however, are not bound to this prioritization. Rather, their
circuit typically has to support just one very specic application type and the circuit can be rebuilt whenever it is no longer adequate for the current application load. And specialization usually
yields sucient performance advantages, so a slow path (e.g., using a general-purpose processor)
for exceptional situations will not seriously aect performance.
Given this freedom to re-decide on trade-os, it is really not clear which point in the design
space should be chosen for a particular use case. As we already discussed in Chapter 4, existing
research mostly explored congurations with fairly extreme decisions. We think, however, that
the true potential of FPGA lies in the open space in-between. Most likely, the sweet spot is when
dierent processing units, composed of one or more FPGA units; one or more general-purpose
CPUs; and potentially even more units, operate together in the form of a hybrid system design.
93
APPENDIX
A.1
NETFPGA
A.2
94
spective, Solarares AOE and the NetFPGA are conceptually similar, however, the focus is different. While NetFPGA is a very FPGA-centric project, in Solarares AOE the FPGA is added
to an existing product as a bump-in-the-wire co-processor. at is, the existing software stack
for Solarfalres NICs still runs on AOE, and only users with extreme performance demands, say
for high-frequency trading, will start moving parts of the application into the FPGA on the NIC.
is makes the transition to an FPGA-based system very smooth.
A.3
Fusion I/O operates in the PCIe SSD market. Solid state drives (SSDs) access ash storage
via SATA/SAS interface, which were designed for hard disk access. Fusion I/Os ioDrive cards
allow direct access to a ash memory storage tier via PCI Express, oering lower latency and
better overall performance than commodity SSDs. Since Fusion I/O is a young company with a
revolutionary product, they decided to implement the ash controller on the ioDrive card using
an FPGA, rather than an ASIC. is allows the company to easily modify the controller, and
provide hardware-updates to their customers. However, notice that here the FPGA really is a
means to an end, i.e., ioDrive is a pure storage solution, and it is not intended that users program
the FPGA themselves.
95
Bibliography
Daniel J. Abadi, Yanif Ahmad, Magdalena Balazinska, Ugur etintemel, Mitch Cherniack,
Jeong-Hyon Hwang, Wolfgang Lindner, Anurag Maskey, Alex Rasin, Esther Ryvkina, Nesime Tatbul, Ying Xing, and Stanley B. Zdonik. e design of the Borealis stream processing
engine. In Proc. 2nd Biennial Conf. on Innovative Data Systems Research, pages 277289, January 2005. 70
Arvind Arasu, Spyros Blanas, Ken Eguro, Raghav Kaushik, Donald Kossmann, Ravi Ramamurthy, and Ramaratnam Venkatesan. Orthogonal security with Cipherbase. In Proc. 6th
Biennial Conf. on Innovative Data Systems Research, January 2013. 7, 86, 88
Joshua Auerbach, David F. Bacon, Ioana Burcea, Perry Cheng, Stephen J. Fink, Rodric Rabbah,
and Sunil Shukla. A compiler and runtime for heterogeneous computing. In Proc. 49th Design
Automaton Conference, pages 271276, June 2012. DOI: 10.1145/2228360.2228411 40
Sumeet Bajaj and Radu Sion. Trusteddb: a trusted hardware based database with privacy and
data condentiality. In Proc. ACM SIGMOD Int. Conf. on Management of Data, pages 205
216, June 2011. DOI: 10.1145/1989323.1989346 86
Zoran Basich and Emily Maltby. Looking for the next big thing? ranking the top 50 start-ups.
e Wall Street Journal, September 2012. 32
Stephan Brzsnyi, Donald Kossmann, and Konrad Stocker. e skyline operator. In Proc. 17th
Int. Conf. on Data Engineering, 2001. DOI: 10.1109/ICDE.2001.914855 77
Mike Butts. Synchronization through communication in a massively parallel processor array.
IEEE Micro, 27(5):3240, September 2007. DOI: 10.1109/MM.2007.4378781 91
Christopher R. Clark and David E. Schimmel. Scalable pattern matching for high speed networks. In Proc. 12th IEEE Symp. on Field-Programmable Custom Computing Machines, pages
249257, April 2004. DOI: 10.1109/FCCM.2004.50 69
Graham Cormode and Marios Hadjieleftheriou. Finding frequent items in data streams. Proc.
VLDB Endowment, 1(2):15301541, 2008. DOI: 10.1007/3-540-45465-9_59 46
NVIDIA Corp. NVIDIAs next generation CUDA compute architecture: Kepler GK110,
2012. White Paper; version 1.0. 49
96
BIBLIOGRAPHY
Sudipto Das, Shyam Antony, Divyakant Agrawal, and Amr El Abbadi. read cooperation
in multicore architectures for frequency counting over multiple data streams. Proc. VLDB
Endowment, 2(1):217228, August 2009. 46
Jerey Dean and Sanjay Ghemawat. MapReduce: Simplied data processing on large clusters.
In Proc. 6th USENIX Symp. on Operating System Design and Implementation, pages 137150,
December 2004. DOI: 10.1145/1327452.1327492 42
R.H. Dennard, F.H. Gaensslen, V.L. Rideout, E. Bassous, and A.R. LeBlanc. Design of ionimplanted mosfets with very small physical dimensions. Solid-State Circuits, IEEE Journal of,
9(5):256268, October 1974. DOI: 10.1109/JSSC.1974.1050511 1
Christopher Dennl, Daniel Ziener, and Jrgen Teich. On-the-y composition of FPGA-based
SQL query accelerators using a partially recongurable module library. In Proc. 20th IEEE
Symp. on Field-Programmable Custom Computing Machines, pages 4552, May 2012. DOI:
10.1109/FCCM.2012.18 35, 68, 69
David J. DeWitt. DIRECTa multiprocessor organization for supporting relational database
management systems. IEEE Trans. Comput., c-28(6):182189, June 1979.
DOI: 10.1109/TC.1979.1675379 70
Hadi Esmaeilzadeh, Emily Blem, Renee St. Amant, Karthikeyan Sankaralingam, and Doug
Burger. Dark silicon and the end of multicore scaling. In Proc. 38th Annual Symp. on Computer
Architecture, pages 365376, 2011. DOI: 10.1145/2024723.2000108 4
Robert W. Floyd and Jerey D. Ullman. e compilation of regular expressions into integrated
circuits. J. ACM, 29(3):603622, July 1982. DOI: 10.1145/322326.322327 54
Phil Francisco. e Netezza Data Appliance Architecture: A platform for high performance data
warehousing and analytics. Technical Report REDP-4725-00, IBM Redguides, June 2011. 6,
36
Craig Gentry. Computing arbitrary functions of encrypted data. Commun. ACM, 53(3):97105,
March 2010. DOI: 10.1145/1666420.1666444 86
Michael T. Goodrich. Data-oblivious external-memory algorithms for the compaction, selection,
and sorting of outsourced data. In Proc. 23rd Annual ACM Symp. on Parallelism in Algorithms
and Architectures, June 2011. DOI: 10.1145/1989493.1989555 88
Naga K. Govindaraju, Brandon Lloyd, Wei Wang, Ming C. Lin, and Dinesh Manocha. Fast
computation of database operations using graphics processors. In Proc. ACM SIGMOD Int.
Conf. on Management of Data, pages 215226, June 2004. DOI: 10.1145/1007568.1007594
49
BIBLIOGRAPHY
97
Naga K. Govindaraju, Jim Gray, Ritesh Kumar, and Dinesh Manocha. GPUTeraSort:
High performance graphics co-processor sorting for large database management. In Proc.
ACM SIGMOD Int. Conf. on Management of Data, pages 325336, June 2006. DOI:
10.1145/1142473.1142511 49
David J. Greaves and Satnam Singh. Kiwi: Synthesis of FPGA circuits from parallel programs.
In Proc. 16th IEEE Symp. on Field-Programmable Custom Computing Machines, pages 312,
April 2008. DOI: 10.1109/FCCM.2008.46 41
Anthony Gregerson, Amin Farmahini-Farahani, Ben Buchli, Steve Naumov, Michail Bachtis,
Katherine Compton, Michael Schulte, Wesley H. Smith, and Sridhara Dasu. FPGA design analysis of the clustering algorithm for the CERN Large Hadron Collider. In Proc. 17th
IEEE Symp. on Field-Programmable Custom Computing Machines, pages 1926, 2009. DOI:
10.1109/FCCM.2009.33 70
Bingsheng He, Ke Yang, Rui Fang, Mian Lu, Naga K. Govindaraju, Qiong Luo, and Pedro V.
Sander. Relational joins on graphics processors. In Proc. ACM SIGMOD Int. Conf. on Management of Data, pages 511524, June 2008. DOI: 10.1145/1376616.1376670 49
Martin C. Herbordt, Yongfeng Gu, Tom VanCourt, Josh Model, Bharat Sukhwani, and Matt
Chiu. Computing models for FPGA-based accelerators. Computing in Science and Engineering,
10(6):3545, 2008. DOI: 10.1109/MCSE.2008.143 24
Mark D. Hill and Michael R. Marty. Amdahls law in the multicore era. IEEE Computer, 41(7):
3338, July 2008. DOI: 10.1109/MC.2008.209 3
Amir Hormati, Manjunath Kudlur, Scott A. Mahlke, David F. Bacon, and Rodric M. Rabbah.
Optimus: Ecient realization of streaming applications on FPGAs. In Proc. Intl Conf. on
Compilers, Architecture, and Synthesis for Embedded Systems, pages 4150, October 2008. DOI:
10.1145/1450095.1450105 40, 41
Intel Corp. e Intel Xeon Phi coprocessor 5110P, 2012. Product Brief; more information
at http://www.intel.com/xeonphi. 49
Hubert Kaeslin. Digital Integrated Circuit Design. Cambridge University Press, 2008. ISBN
978-0-521-88267-5. 44, 48
Adam Kirsch and Michael Mitzenmacher. e power of one move: Hashing schemes for hardware. IEEE/ACM Transactions on Networking, 18(6):17521765, December 2010. DOI:
10.1109/TNET.2010.2047868 66
Dirk Koch and Jim Torresen. FPGASort: A high performance sorting architecture exploiting
run-time reconguration on FPGAs for large problem sorting. In Proc. 19th ACM SIGDA Int.
Symp. on Field Programmable Gate Arrays, 2011. DOI: 10.1145/1950413.1950427 73, 74, 75,
76
98
BIBLIOGRAPHY
Ian Kuon and Jonathan Rose. Measuring the gap between FPGAs and ASICs. IEEE
Trans. Computer-Aided Design of Integrated Circuits, 26(2), February 2007. DOI: 10.1109/TCAD.2006.884574 90
Zhiyuan Li and Scott Hauck. Conguration compression for Virtex FPGAs. In Proc. 9th IEEE
Symp. on Field-Programmable Custom Computing Machines, pages 147159, April 2001. DOI:
10.1109/FCCM.2001.19 68
John W. Lockwood, Adwait Gupte, Nishit Mehta, Michaela Blott, Tom English, and Kees
Vissers. A low-latency library in FPGA hardware for high-frequency trading (HFT). In
IEEE 20th Annual Symp. on High-Performance Interconnects, pages 916, August 2012. DOI:
10.1109/HOTI.2012.15 62, 93
Anil Madhavapeddy and Satnam Singh. Recongurable data processing for clouds. In Proc. 19th
IEEE Symp. on Field-Programmable Custom Computing Machines, pages 141145, May 2011.
DOI: 10.1109/FCCM.2011.35 6
Ken Mai, Tim Paaske, Nuwan Jayasena, Ron Ho, William J. Dally, and Mark Horowitz. Smart
memories: A modular recongurable architecture. In Proc. 27th Symp. on Computer Architecture,
pages 161171, June 2000. DOI: 10.1145/342001.339673 91
Robert McNaughton and Hisao Yamada. Regular expressions and state graphs for automata.
IEEE Trans. Electr. Comp., 9:3947, 1960. DOI: 10.1109/TEC.1960.5221603 52
Ahmed Metwally, Divyakant Agrawal, and Amr El Abbadi. An integrated ecient solution for
computing frequent and top-k elements in data streams. ACM Trans. Database Syst., 31(3):
10951133, September 2006. DOI: 10.1145/1166074.1166084 46, 47
Abhishek Mitra, Marcos R. Vieira, Petko Bakalov, Vassilis J. Tsotras, and Walid A. Najjar. Boosting XML ltering through a scalable FPGA-based architecture. In Proc. 4th Biennial Conf. on
Innovative Data Systems Research, January 2009. 69
Roger Moussalli, Mariam Salloum, Walid A. Najjar, and Vassilis J. Tsotras. Massively parallel
XML twig ltering using dynamic programming on FPGAs. In Proc. 27th Int. Conf. on Data
Engineering, pages 948959, April 2011. DOI: 10.1109/ICDE.2011.5767899 69
Rene Mueller, Jens Teubner, and Gustavo Alonso. Streams on wiresa query compiler for FPGAs. Proc. VLDB Endowment, 2(1):229240, August 2009. 62, 63, 65, 66
Rene Mueller, Jens Teubner, and Gustavo Alonso. Glacier: A query-to-hardware compiler. In
Proc. ACM SIGMOD Int. Conf. on Management of Data, pages 11591162, June 2010. DOI:
10.1145/1807167.1807307 62
Rene Mueller, Jens Teubner, and Gustavo Alonso. Sorting networks on FPGAs. VLDB J., 21
(1):123, February 2012. DOI: 10.1007/s00778-011-0232-z 71, 72, 73
BIBLIOGRAPHY
99
Rasmus Pagh and Flemming Friche Rodler. Cuckoo hashing. In Proc. 9th European Symp. on
Algorithms, pages 121133, August 2001. DOI: 10.1007/978-0-387-30162-4_97 66
Sungwoo Park, Taekyung Kim, Jonghyun Park, Jinha Kim, and Hyeonseung Im. Parallel skyline
computation on multicore architectures. In Proc. 25th Int. Conf. on Data Engineering, 2009.
DOI: 10.1109/ICDE.2009.42 80, 81
Oliver Pell and Vitali Averbukh. Maximum performance computing with dataow engines. Computing in Science and Engineering, 14(4):98103, 2012. DOI: 10.1109/MCSE.2012.78 49
Mohammad Sadoghi, Harsh Singh, and Hans-Arno Jacobsen. Towards highly parallel event
processing through recongurable hardware. In Proc. 7th Workshop on Data Management on
New Hardware, pages 2732, June 2011. DOI: 10.1145/1995441.1995445 69
David Schneider. e microsecond market. IEEE Spectrum, 49(6):6681, June 2012. DOI:
10.1109/MSPEC.2012.6203974 62
Reetinder Sidhu and Viktor K. Prasanna. Fast regular expression matching using FPGAs. In
Proc. 9th IEEE Symp. on Field-Programmable Custom Computing Machines, pages 227238,
April 2001. DOI: 10.1109/FCCM.2001.22 54
Satnam Singh. Computing without processors. Commun. ACM, 54(8):4654, August 2011.
DOI: 10.1145/1978542.1978558 41
Michael Stonebraker, Samuel Madden, Daniel J. Abadi, Stavros Harizopoulos, Nabil Hachem,
and Pat Helland. e end of an architectural era: (its time for a complete rewrite). In Proc.
33rd Int. Conf. on Very Large Data Bases, pages 11501160, 2007. 4
Tabula, Inc. Spacetime architecture, 2010. URL http://www.tabula.com/. White Paper.
68
Michael B. Taylor. Is dark silicon useful? harnessing the four horsemen of the coming dark silicon
apocalypse. In Proc. 49th Design Automaton Conference, June 2012.
DOI: 10.1145/2228360.2228567 89
Jens Teubner and Louis Woods. Snowfall: Hardware stream analysis made easy. In Proc. 14th
Conf. on Databases in Business, Technology, and Web, pages 738741, March 2011. 67
Jens Teubner, Rene Mueller, and Gustavo Alonso.
Frequent item computation on a
chip.
IEEE Trans. Knowl. and Data Eng., 23(8):11691181, August 2011. DOI:
10.1109/TKDE.2010.216 46, 47, 48
Jens Teubner, Louis Woods, and Chongling Nie. Skeleton automata for FPGAs: Reconguring
without reconstructing. In Proc. ACM SIGMOD Int. Conf. on Management of Data, pages
229240, May 2012. DOI: 10.1145/2213836.2213863 36, 45
100
BIBLIOGRAPHY
Ken ompson. Programming techniques: Regular expression search algorithm. Commun. ACM,
11(6):419422, 1968. DOI: 10.1145/363347.363387 52
Maamar Touiza, Gilberto Ochoa-Ruiz, El-Bay Bourennane, Abderrezak Guessoum, and Kamel
Messaoudi. A novel methodology for accelerating bitstream relocation in partially recongurable systems. Microprocessors and Microsystems, 2012. DOI: 10.1016/j.micpro.2012.07.004
30
Philipp Unterbrunner, Georgios Giannikis, Gustavo Alonso, Dietmar Fauser, and Donald Kossmann. Predictable performance for unpredictable workloads. Proc. VLDB Endowment, 2(1):
706717, 2009. 62
Pranav Vaidya and Jaehwan John Lee. A novel multicontext coarse-grained recongurable architecture (CGRA) for accelerating column-oriented databases. ACM Trans. Recong. Technol.
Syst., 4(2), May 2011. DOI: 10.1145/1968502.1968504 38
Pranav Vaidya, Jaehwan John Lee, Francis Bowen, Yingzi Du, Chandima H. Nadungodage,
and Yuni Xia. Symbiote: A recongurable logic assisted data stream management system
(RLADSMS). In Proc. ACM SIGMOD Int. Conf. on Management of Data, pages 11471150,
June 2010. DOI: 10.1145/1807167.1807304 70
Louis Woods, Jens Teubner, and Gustavo Alonso. Complex event detection at wire speed with
FPGAs. Proc. VLDB Endowment, 3(1):660669, September 2010. 58, 59, 60
Louis Woods, Jens Teubner, and Gustavo Alonso. Real-time pattern matching with FPGAs. In Proc. 27th Int. Conf. on Data Engineering, pages 12921295, April 2011. DOI:
10.1109/ICDE.2011.5767937 59, 60
Louis Woods, Jens Teubner, and Gustavo Alonso. Parallel computation of skyline queries. In
Proc. 21st IEEE Symp. on Field-Programmable Custom Computing Machines, April 2013. 77,
78, 79, 80, 81
Yi-Hua E. Yang and Viktor K. Prasanna. High-performance and compact architecture for regular
expression matching on FPGA. IEEE Trans. Comput., 61(7):10131025, July 2012. DOI:
10.1109/TC.2011.129 45, 55, 56
Yi-Hua E. Yang, Weirong Jiang, and Viktor K. Prasanna. Compact architecture for highthroughput regular expression matching on FPGA. In Proc. ACM/IEEE Symp. on Architecture for Networking and Communication Systems, pages 3039, November 2008. DOI:
10.1145/1477942.1477948 46, 55, 56, 57, 58
101
Authors Biographies
JENS TEUBNER
Jens Teubner is leading the Databases and Information Systems Group at TU Dortmund in Germany. His main research interest is data processing on modern hardware platforms, including FPGAs, multi-core processors, and hardwareaccelerated networks. Previously, Jens Teubner was a postdoctoral researcher at ETH Zurich (20082013) and IBM Research (20072008). He holds a Ph.D. in Computer Science
from TU Mnchen (Munich, Germany) and an M.S. degree
in Physics from the University of Konstanz in Germany.
LOUIS WOODS
Louis Woods is a Ph.D. student, who joined the Systems
Group at ETH Zurich in 2009. His research interests include FPGAs in the context of databases, modern hardware,
stream processing, parallel algorithms, and design patterns.
Louis Woods received both his B.S. and M.S. degree in Computer Science from ETH Zurich in 2008 and 2009, respectively.
103
Index
bitstream, 28
bitstream authentication, 85
bitstream encryption, 85
block nested loops, 77
Block RAM (BRAM), 24
carry chain, 21
CEP (complex event processing), 58
chip space, 58
Cipherbase, 83, 86
CLB, see logic island
clock signal, 11, 39, 65
cloud computing, 6
co-processor, 51
combinational logic, 9
complex event processing, 58
congurable logic block, see logic island
cryptoprocessor, 86
dark silicon, 89
data ow computing, 49
data parallelism, 42
data path, 61
de-serialization, 67
Dennard scaling, 1
deterministic automaton, 52
DFA, 52
die stacking, 30
distributed RAM, 19
DSP unit, 25
electronic stock trading, 62
Glacier, 62
GPU, 3, 48
graphics processor, 3, 48
hard cores, 26
hardware description language, 12
hash table, 66
high-frequency trading (HFT), 62
high-level synthesis, 32, 40
homomorphic encryption, 86
instruction set processor, 37
interconnect, 9, 22
latch, 11
line-rate performance, 60, 93
logic island, 21
look-up table (LUT), 18
many-core processor, 49
map (design ow), 28
memory, 9
merge sorter, 73
Moores Law, 1, 89
multiplexer, 9, 13
104
INDEX
NetFPGA, 93
network intrusion detection, 5, 51, 56
NFA, 52
non-deterministic automaton, 52
parameterization, 35
partial reconguration, 28, 34, 69, 75
pattern matching, 51
PCI Express, 93
pipelining, 43, 57
in FPGAs, 45
place and route (design ow), 28
PLD (programmable logic device), 17
power consumption, 2
programmable logic devices, 17
propagation delay, 10, 56, 72
push-based execution, 64
query compilation, 64
RAM
distributed, 19, 24
reconguration
partial, 28
register-transfer level, 14
regular expression, 51
replication, 42
risk management, 62
RTL (register-transfer level), 14
security, 6
sequential logic, 10
asynchronous, 11
synchronous, 11
serialization, 67
simulation, 13
skeleton automata, 36
skyline operator, 76
slice, see elementary logic unit
soft cores, 26
Solarare, 93
sorting, 71
sorting network, 71
stack machine, 88
stream partitioning, 58
stream processing, 5
synthesis, 14, 27
time-multiplexed FPGAs, 31
translate (design ow), 27
tree merge sorter, 74
trusted platform module, 83
von Neumann architecture, 83
von Neumann bottleneck, 2
XPath, 36