46
Building Compilers for Reconfigurable Switches Lavanya Jose, Lisa Yan, Nick McKeown, and George Varghese 1 Research funded by AT&T, Intel, Open Networking Research Center.

Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

BuildingCompilersforReconfigurableSwitches

LavanyaJose,LisaYan,NickMcKeown,andGeorgeVarghese

1ResearchfundedbyAT&T,Intel,OpenNetworkingResearchCenter.

Page 2: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Inthenext20minutes

•  Fixed-funcPonswitchchipswillbereplacedbyreconfigurableswitchchips

•  WewillprogramthemusinglanguageslikeP4•  WeneedacompilertocompileP4programstoreconfigurableswitchchips.

2

Page 3: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Fixed-FuncPonSwitchChips

QueuesL2

StageIPv4StagePa

rser IPv6

StageACLStage

L3

L2

Packet

Packet

3

Page 4: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

ControlFlowGraph

QueuesL2

StageIPv4StagePa

rser IPv6

StageACLStageL2

Table

IPv4Table

IPv6

Table

ACLTable

L2v4

v6ACL

ControlFlowGraph

SwitchPipeline

FixedAcPo

n

FixedAcPo

n

AcPon

FixedAcPo

n

4

Page 5: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Fixed-FuncPonSwitchChipsAreLimited

1.  Can’taddnewforwardingfuncPonality2.  Can’taddnewmonitoringfuncPonality

5

Page 6: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Fixed-FuncPonSwitchChips

QueuesL2

StageIPv4StagePa

rser IPv6

StageACLStageL2

Table

IPv4Table

IPv6

Table

ACLTable

FixedAcPo

n

FixedAcPo

n

AcPo

n

FixedAcPo

n

L2v4

v6ACL

ControlFlowGraph

SwitchPipeline

MyEncapMyEncap

6

Page 7: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

7

Fixed-FuncPonSwitchChipsAreLimited

1.  Can’taddnewforwardingfuncPonality2.  Can’taddnewmonitoringfuncPonality3.  Can’tmoveresourcesbetweenfuncPons

QueuesL2Stage

IPv4Stage

Parser IPv6

Stage

ACLStageFi

xedAcPo

n

FixedAcPo

n

AcPo

n

L2Table

FixedAcPo

n

IPv4Table

IPv6

Table

ACLTable

Page 8: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

ControlFlowGraph

SwitchPipeline

ReconfigurableSwitchChips

Queues

Parser

FixedAcPo

n

FixedAcPo

n

FixedAcPo

n

L2Table

FixedAcPo

n

IPv4Table

IPv6Table

ACLTable

MatchTable

MatchTable

MatchTable

MatchTable

L2v4

v6ACL

AcPo

nMacro

AcPo

nMacro

AcPo

nMacro

AcPo

nMacro

8

Page 9: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

MatchTable

AcPo

nMacro

MappingControlFlowtoReconfigurableChip.

Queues

Parser

MatchTable

MatchTable

MatchTable

L2Table

IPv4Table

IPv6Table

ACLTable

AcPo

nMacro

AcPo

nMacro

AcPo

nMacro

L2v4

v6ACL

ControlFlowGraph

SwitchPipeline

L2

v6ACL

v4

L2AcPon

Macro

v4AcPon

Macro

v6AcPon

ACLAcPo

nMacro

9

Page 10: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

ControlFlowGraph

SwitchPipeline

ReconfigurableSwitchChips

Queues

Parser

L2Table

IPv4Table

ACLTable

IPv6

MyEncap

L2v4

v6ACL

MyEncapL2AcPon

Macro

v4AcPon

Macro

ACLAcPo

nMacro

AcPo

n

MyEncap

AcPo

n

IPv4

AcPo

n

IPv4

AcPo

n

10

IPv6

IPv4

AcPo

n

Page 11: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Parser

L2Table

IPv4Table

IPv6Table

ACLTable

MatchMemory

AcPonALU

ProtocolIndependentSwitch

L2AcPon

Macro

v4AcPon

Macro

v6AcPon

Macro

ACLAcPo

nMacro

11

Page 12: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Parser

L2Table

IPv4Table

IPv6

ACL

Table

IPv4Table

IPv4

Table

L2AcPon

Macro

v4AcPon

Macro

AcPo

n

AcPo

n

AcPo

n

12

Page 13: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Match+AcPonProcessor:pipelinedandin-parallel

13

Page 14: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Reconfigurability:thenormin5years

•  Reconfigurabilityaddsmostlytologic.•  LogicisgeangrelaPvelysmaller.•  Thecostofreconfigurabilityisgoingdown.•  Fixedswitchchipareatoday:–  I/O(40%),Memory(40%),– Wires,Logic

SwitchI/O(30%)

Memory(30%)

Wires(20%)

Logic(20%)

SwitchI/O

Memory

Wires Logic

14

Page 15: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

FixedFunc-onBroadcomTomahawk:3.2TbpsReconfigurableCaviumXpliant:3.2Tbps

15

Page 16: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Reconfigurablechipsareinevitable.

16

Page 17: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

ConfiguringSwitchChipsP4code

Compiler

CompilerTarget

Queues

Parser

FixedAcPo

n

FixedAcPo

n

FixedAcPo

n

L2Table

FixedAcPo

n

IPv4Table

IPv6Table

ACLTable

MatchTable

MatchTable

MatchTable

MatchTable

AcPo

nMacro

AcPo

nMacro

AcPo

nMacro

AcPo

nMacro

17

Page 18: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Queues

Parser

FixedAcPo

n

FixedAcPo

n

FixedAcPo

n

L2Table

FixedAcPo

n

IPv4Table

IPv6Table

ACLTable

MatchTable

MatchTable

MatchTable

MatchTable

P4(hgp://p4.org/)

parser parse_ethernet {! extract(ethernet);!select(latest.etherType) {! 0x800 : parse_ipv4;! 0x86DD : parse_ipv6;! }!}!

�table ipv4_lpm {! reads {! ipv4.dstAddr : ! lpm;! }! actions {! set_next_hop;! drop; ! }!}!

control ingress !{! apply(l2_table);! if (valid(ipv4)) {! apply(ipv4_table);! }! if (valid(ipv6)) {! apply(ipv6_table);! }! apply (acl);!}!

L2 v4v6

ACL

AcPo

nMacro

AcPo

nMacro

AcPo

nMacro

AcPo

nMacro

18

(ANCS’13)Parser

MatchAcPonTables

ControlFlowGraph

Page 19: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Whatdoesreconfigurabilitybuyus?

19

Page 20: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

•  Useresourcesefficiently– MulPpletablesperstage– BigtableinmulPplestages

•  UsefewerstagesL2

IPv4

IPv6ACL

BenefitsofReconfigurability

20

Page 21: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

NaïveMapping:ControlFlowGraphParser

MatchTable

MatchTable

MatchTable

MatchTable

AcPo

nMacro

AcPo

nMacro

AcPo

nMacro

AcPo

nMacro

L2v4

v6ACL

ControlFlow

SwitchPipeline

Queues

L2Table

IPv4Table

IPv6Table

ACL

Table

L2

v6ACL

v4

AcPo

n

v4AcPon

Macro

v6AcPon

Macro

AcPo

n

21

Page 22: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

ControlFlowGraph

L2

TableDependencyGraph(TDG)

v4

v6ACL

L2

v4

v6

ACL

TableDependencyGraph

22

Page 23: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

SwitchPipeline

EfficientMapping:TDG

Queues

Parser L2Table

IPv4Table

IPv6Table

TableDependencyGraphControlFlowGraph

L2v4

v6ACLL2

v4

v6

ACLAcPo

n

v4AcPon

Macro

v6AcPon

Macro

23AC

LTable

AcPo

n

Page 24: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

L2

ControlFlowGraph

SwitchPipeline

Resourceconstraints

v4

v6ACL

Queues

Parser

L2Table

IPv6

IPv4

L3

L2

v6

v4

L2AcPon

Macro

v4AcPon

Macro

v6AcPon

Macro

AcPo

n

ACLTable

24

Page 25: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

25

Headerwidths

AcPonALUinputMemoryType

Tableparallelism

Moreresourceconstraints

AcPonMemory

Page 26: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

MapmatchacPontablesinaTDGtoaswitchpipelinewhilerespecPngdependencyand

resourceconstraints.

TheCompilerProblem

26

Page 27: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Step1:P4Program

Step2:ControlFlowGraph

L2v4

v6ACL

27

Step3:TableDependencyGraph

L2 v4

v6ACL

Step4:TableConfiguraPon

Page 28: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Isthatit?

28

Page 29: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

TwoSwitchesWeStudied1 2 3 4 32…

14

3 5

2

RMT32Stages

(SIGCOMM2013)

FlexPipe5Stages

(IntelFM6000)

29

Page 30: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

AddiPonalswitchfeatures

L2

v4

v6

ACL

L2

L2

v4

v6

TableshapinginRMT TablesharinginFlexPipe

30

Page 31: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

31

MapmatchacPontablesinaTDGtoaswitchpipelinewhilerespecPngdependencyand

resourceconstraints.

TheCompilerProblem

Tableshaping Tablesharing

Headerwidths AcPonALUinput

MemoryType

TableparallelismAcPonMemory

Page 32: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Firstapproach:Greedy

•  PrioriPzeoneconstraint•  Sorttables•  MaptablesoneataPme

Queues

Parser

32

12 3

3 Sortby#dependencies

Page 33: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Firstapproach:Greedy

Queues

Parser

1

•  PrioriPzeoneconstraint•  Sorttables•  MaptablesoneataPme

2 3 4

11 Sortbymatchwidth

33

Page 34: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

ToomanyconstraintsforGreedy

•  AnygreedymustsorttablesbasedonametricthatisafixedfuncPonofconstraints.

•  Asthenumberofconstraintsgetslarger,it’sharderforafixedfuncPontorepresenttheinterplaybetweenallconstraints.

•  Canwedobegerthangreedy?

34

Page 35: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Secondapproach:IntegerLinearProgramming(ILP)

FindanopPmalmapping.

Pros:•  Takesinallconstraints•  DifferentobjecPves•  Solversexist(CPLEX)

35

Cons:•  Blackboxsolver•  Encodingisanart•  Slow

Page 36: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

ILPSetup

min#stagessubjectto:

dependencyconstraints

36

tablesizesassignedmemoriesassigned

tablesizesspecifiedmemoriesinphysicalstage

Page 37: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

ExperimentSetup

•  4datacenterusecasesfromIntel,Barefoot

•  Differintables,tablesizes,anddependencies

37

Page 38: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

ExampleUseCase

ATypicalTDG

38

IPv6-Mcast

EG-ACL1

EG-Phy-Meta

IG-Agg-Int

IG-Dmac

IPv4-Mcast

IPv4-Nexthop

IPv6-Nexthop

IG-Props

IG-Router-Mac

Ipv4-Ecmp

IG-Smac

Ipv4-Ucast-LPM

Ipv4-Ucast-Host

Ipv6-Ucast-Host

Ipv6-Ucast-LPM

Ipv6-Ecmp

IG_ACL2

IG_Bcast_Storm

Ipv4_Urpf

Ipv6_Urpf

IG_ACL1

EG_Props

IG_Phy_Meta

ConfiguraPonforRMT

Page 39: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Metrics:GreedyvsILP

1.  Abilitytofitprograminchip

2.  OpPmality

3.  RunPme

39

Page 40: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Setup:GreedyvsILP

1.  Abilitytofit:FlexPipe– Variantsofusecasesin5-stagepipeline.

2.  OpPmality:RMT– Minimumstage,pipelinelatency,power

3.  RunPme:bothswitches

40

Page 41: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Results:GreedyvsILP

1.  CanGreedyfitmyprogram?–  Yes,ifresourcesaplenty(RMT,32stages)– No,ifresourcesconstrained(FlexPipe,5stages),

Can’tfit25%ofprograms.2.  HowclosetoopPmalisGreedy?–  30%morePmeforpackettogetthroughRMTpipeline.

3.  Hmm..lookslikeIneedILP.Howslowisit?–  100xslowerthanGreedy–  Reasonableifprogramsdon’tchangeoven.

41

Page 42: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

IfwehavePme,weshouldrunILP.

42

Page 43: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

UseILPtosuggestbestGreedyforprogramtype.

43

CriPcalconstraints•  DependencycriPcal:16à13stages•  AddiPonalresourceconstraintslessimportantCriPcalresources•  TCAMmemoriescriPcal:16à14stages– ResultsforoneofourdatacenterL2/L3usecases

Page 44: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Conclusion•  Challenge:Parallelismandconstraintsinreconfigurablechipsmakescompilingdifficult.

•  TDG:highlightsparallelisminprogram.•  ILP:begerifenoughPme,fiangiscriPcal,orobjecPvesarecomplicated.

•  BestGreedy:ILPcanchoosevianoPonofcri1calconstraintsandcri1calresources.

44

Page 45: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

Thankyou!

45ResearchfundedbyAT&T,Intel,OpenNetworkingResearchCenter.

Page 46: Building Compilers for Reconfigurable Switches• We will program them using languages like P4 • We need a compiler to compile P4 programs to reconfigurable switch chips. ... Protocol

ILPRunPme

•  Numberofconstraints?Notobvious.E.g.,RMT– Min.stage:fewsecs.– Min.power:fewsecs.– Min.pipelinelatency10xslower

•  Numberofvariables?Howfine-grainedistheresourceassignment?E.g.,FlexPipe– OnematchentryataPme:manydays..–  100-500matchentriesataPme:<1hr