Lyra: A Cross-Platform Language and Compiler for Data ... · src: 10.2.2.2 … Drop Add ID Add...
Transcript of Lyra: A Cross-Platform Language and Compiler for Data ... · src: 10.2.2.2 … Drop Add ID Add...
Lyra: A Cross-Platform Language and Compiler for Data Plane Programming on Heterogeneous ASICs
Jiaqi Gao, Ennan Zhai, Hongqiang Harry Liu, Rui Miao, Yu ZhouBingchuan Tian, Chen Sun, Dennis Cai, Ming Zhang, Minlan Yu
Programmable switches gain significant traction
2
Mem
ory
ALU
Mem
ory
ALU
Mem
ory
ALU
Mem
ory
ALU
Parser
ACL
Tabl
e
L2 T
able
IPv4
Ta
ble
IPv6
Ta
ble
Pars
er
Fixed-Function ASIC Programmable ASIC
Programmable switches gain significant traction
3
Mem
ory
ALU
Mem
ory
ALU
Mem
ory
ALU
Mem
ory
ALU
Parser
ACL
Tabl
e
L2 T
able
IPv4
Ta
ble
IPv6
Ta
ble
Pars
er
Fixed-Function ASIC Programmable ASIC
Programmable switches gain significant traction
4
Mem
ory
ALU
Mem
ory
ALU
Mem
ory
ALU
Mem
ory
ALU
Parser
ACL
Tabl
e
L2 T
able
IPv4
Ta
ble
IPv6
Ta
ble
Pars
er
Fixed-Function ASIC Programmable ASIC
Data plane programming is still at an early stage …
5
Data plane programming is still at an early stage …
6
Chip specific languages ~ Assembly languages
Running example: A network sequencer
7
Sequencer
…
Replica Server ID: 1
Replica Server ID: 2
Replica Server ID: 8
Running example: A network sequencer
8
Linearizing the transactions for consensus protocols such as Paxos
Sequencer
…
Replica Server ID: 1
Replica Server ID: 2
Replica Server ID: 8
Running example: A network sequencer
Add sequence header to selected flows and drop others
9
Filtersrc: 10.0.0.1
src: 10.1.0.2
src: 10.2.2.2
… Drop
Add ID Add Timestamp
Add Sequence
No Hit
Hit Routing
Linearizing the transactions for consensus protocols such as Paxos
Running example: A network sequencer
10
Sequencer
…
Replica Server ID: 1
Replica Server ID: 2
Replica Server ID: 8
Filtersrc: 10.0.0.1
src: 10.1.0.2
src: 10.2.2.2
… Drop
Add ID Add Timestamp
Add Sequence
No Hit
Hit Routingsrc: 10.0.0.1
Add sequence header to selected flows and drop others
Linearizing the transactions for consensus protocols such as Paxos
Filtersrc: 10.0.0.1
src: 10.1.0.2
src: 10.2.2.2
… Drop
Add ID Add Timestamp
Add Sequence
No Hit
Hit Routing
Running example: A network sequencer
11
Sequencer
…
src: 10.0.0.1 ID: 1 T: 23
Replica Server ID: 1
Replica Server ID: 2
Replica Server ID: 8
Add sequence header to selected flows and drop others
Linearizing the transactions for consensus protocols such as Paxos
Filtersrc: 10.0.0.1
src: 10.1.0.2
src: 10.2.2.2
… Drop
Add ID Add Timestamp
Add Sequence
No Hit
Hit Routing
Running example: A network sequencer
12
Sequencer
…
src: 10.0.0.1 ID: 1 T: 23
Replica Server ID: 1
Replica Server ID: 2
Replica Server ID: 8
Add sequence header to selected flows and drop others
Linearizing the transactions for consensus protocols such as Paxos
Running example: A network sequencer
13
Sequencer
…
Filtersrc: 10.0.0.1
src: 10.1.0.2
src: 10.2.2.2
… Drop
Add ID Add Timestamp
Add Sequence
No Hit
Hit Routingsrc: 9.8.8.8
Replica Server ID: 1
Replica Server ID: 2
Replica Server ID: 8
Add sequence header to selected flows and drop others
Linearizing the transactions for consensus protocols such as Paxos
Problem 1: PortabilityLow level, chip-specific languages
14
Tofino
Problem 1: PortabilityLow level, chip-specific languages
15
// P4_14action a_shift_switch_id(server_id) { shift_left(sequence.seq, server_id, 28);}table shift_switch_id { reads { ipv4.src_ip: exact; } actions { a_shift_switch_id; }}action a_and_timestamp() { bit_and(ig_ts, ig_ts, 0x0FFFFFFF);}table and_timestamp { actions { a_and_timestamp; } default_action: a_and_timestamp();}action a_sequence_header() { add_header(sequence); bit_and(sequence.seq, sequence.seq, ig_ts);}table add_sequence_header { actions { a_sequence_header; } default_action: a_sequence_header();}
Problem 1: PortabilityLow level, chip-specific languages
16
Tofino
// P4_14action a_shift_switch_id(server_id) { shift_left(sequence.seq, server_id, 28);}table shift_switch_id { reads { ipv4.src_ip: exact; } actions { a_shift_switch_id; }}action a_and_timestamp() { bit_and(ig_ts, ig_ts, 0x0FFFFFFF);}table and_timestamp { actions { a_and_timestamp; } default_action: a_and_timestamp();}action a_sequence_header() { add_header(sequence); bit_and(sequence.seq, sequence.seq, ig_ts);}table add_sequence_header { actions { a_sequence_header; } default_action: a_sequence_header();}
Problem 1: PortabilityLow level, chip-specific languages
17
add_header(sequence);sequence.seq = (server_id << 28) & (ig_ts & 0x0FFFFFFF);
Add ID Add Timestamp
Tofino
Tofino
// P4_14action a_shift_switch_id(server_id) { shift_left(sequence.seq, server_id, 28);}table shift_switch_id { reads { ipv4.src_ip: exact; } actions { a_shift_switch_id; }}action a_and_timestamp() { bit_and(ig_ts, ig_ts, 0x0FFFFFFF);}table and_timestamp { actions { a_and_timestamp; } default_action: a_and_timestamp();}action a_sequence_header() { add_header(sequence); bit_and(sequence.seq, sequence.seq, ig_ts);}table add_sequence_header { actions { a_sequence_header; } default_action: a_sequence_header();}
Problem 1: PortabilityLow level, chip-specific languages
18
add_header(sequence);sequence.seq = (server_id << 28) & (ig_ts & 0x0FFFFFFF);
Chip VendorsAdd ID Add Timestamp
Tofino
// P4_14action a_shift_switch_id(server_id) { shift_left(sequence.seq, server_id, 28);}table shift_switch_id { reads { ipv4.src_ip: exact; } actions { a_shift_switch_id; }}action a_and_timestamp() { bit_and(ig_ts, ig_ts, 0x0FFFFFFF);}table and_timestamp { actions { a_and_timestamp; } default_action: a_and_timestamp();}action a_sequence_header() { add_header(sequence); bit_and(sequence.seq, sequence.seq, ig_ts);}table add_sequence_header { actions { a_sequence_header; } default_action: a_sequence_header();}
Problem 1: PortabilityLow level, chip-specific languages
19
add_header(sequence);sequence.seq = (server_id << 28) & (ig_ts & 0x0FFFFFFF);
LanguagesChip VendorsAdd ID Add Timestamp
20
Problem 2: ExtensibilityCannot program across switches
21
Aggregation 1000 entries
Top of Rack 1000 entries
Filter table 300 entries
None
filter (300)
Problem 2: ExtensibilityCannot program across switches
routing(500)
800 entries
22
Aggregation 1000 entries
Top of Rack 1000 entries
Filter table
routing(500)
filter (800)
300 entries
None
filter (300)
Problem 2: ExtensibilityCannot program across switches
routing(500)
1300 entries800 entries
23
Aggregation 1000 entries
Top of Rack 1000 entries
Filter table
routing(500)
filter (800)
300 entries
None
filter (300)
filter (1000)
filter (300)
routing(500)
Problem 2: ExtensibilityCannot program across switches
routing(500)
24
Problem 3: CompositionCo-locate with other programs
25
None
filter (300)
routing(500)
Add an ARP table with 300 entries to the ToR switch
Aggregation 1000 entries
Top of Rack 1000 entries
Problem 3: CompositionCo-locate with other programs
26
filter (100)
ARP table (300)
None
filter (300)
routing(500)
filter (200)
routing(500)
Add an ARP table with 300 entries to the ToR switch
Aggregation 1000 entries
Top of Rack 1000 entries
Problem 3: CompositionCo-locate with other programs
Data plane programming is still at an early stage
Distribute program across multiple switches
Different roles (In-band network telemetry)Expand memory or computation (Sequencer)
ExtensibilityFit multiple programs into one switch
Function overlapping
CompositionMigrate program across switches
PortabilityDifferent languages
Different architecturesDifferent ASIC models
27
Data plane programming is still at an early stage
Distribute program across multiple switches
Different roles (In-band network telemetry)Expand memory or computation (Sequencer)
ExtensibilityFit multiple programs into one switch
Function overlapping
CompositionMigrate program across switches
PortabilityDifferent languages
Different architecturesDifferent ASIC models
28
C language lets you get close to the machine, without getting tied up in the machine.
-- Dr. Brian Kernighan
C language lets you get close to the machine,
without getting tied up in the machine
— Dr. Brain Kernighan
Lyra: A high-level data plane language & compiler
29
Lyra program
NPL (Trident-4)
P4 (Tofino 32Q)
Lyra compiler
Frontend Backend
Chip-specific constraint
Parser Language synthesizer
Preprocessor
Analyzer ExtensibilityOne-big-pipeline modelP4 (Silicon One)
P4 (Tofino 64Q)
Lyra: A high-level data plane language & compiler
30
Lyra program
NPL (Trident-4)
P4 (Tofino 32Q)
Lyra compiler
Frontend Backend
Chip-specific constraint
Parser Language synthesizer
Preprocessor
Analyzer ExtensibilityOne-big-pipeline model
Portability: Language synthesizer
P4 (Silicon One)
P4 (Tofino 64Q)
Lyra: A high-level data plane language & compiler
31
Lyra program
NPL (Trident-4)
P4 (Tofino 32Q)
Lyra compiler
Frontend Backend
Chip-specific constraint
Parser Language synthesizer
Preprocessor
Analyzer ExtensibilityOne-big-pipeline model
Portability: Language synthesizer
Topology-aware code allocation
P4 (Silicon One)
P4 (Tofino 64Q)
Lyra: A high-level data plane language & compiler
32
Lyra program
NPL (Trident-4)
P4 (Tofino 32Q)
Lyra compiler
Frontend Backend
Chip-specific constraint
Parser Language synthesizer
Preprocessor
Analyzer ExtensibilityOne-big-pipeline model
Portability: Language synthesizer
Chip-specific constraint encoding
Topology-aware code allocation
P4 (Silicon One)
P4 (Tofino 64Q)
Lyra language: One-big-pipeline model
33
Lyra language: One-big-pipeline model
34
ToR Tofino
Aggregation Trident-4
ToR Tofino
Aggregation Trident-4
Per-switch model One-big-switch model
One big switch
ToR Tofino
Aggregation Trident-4
ToR Tofino
Aggregation Trident-4
One-big-pipeline model
Lyra language: One-big-pipeline model
35
ToR Tofino
Aggregation Trident-4
ToR Tofino
Aggregation Trident-4
Per-switch model One-big-switch model
One big switchSequencer
ARPARP
Lyra language: Program
36
// Sequencer.lyraheader_type sequence_t{ bit[32] seq;}parser_node parse_sequence{ extract_fields(sequence);}
pipeline[SEQ] {sequencer};
algorithm sequencer { add_sequence(); routing();}
func add_sequence() { extern dict<bit[32] ip, bit[4] id>[300] filter; if (ipv4.src_ip in filter) { add_header(sequence); sequence.seq = (filter[ipv4.src_ip] << 28) \ & (ig_ts & 0x0FFFFFFF); } else { drop(); }}
Lyra language: Program
37
// Sequencer.lyraheader_type sequence_t{ bit[32] seq;}parser_node parse_sequence{ extract_fields(sequence);}
pipeline[SEQ] {sequencer};
algorithm sequencer { add_sequence(); routing();}
func add_sequence() { extern dict<bit[32] ip, bit[4] id>[300] filter; if (ipv4.src_ip in filter) { add_header(sequence); sequence.seq = (filter[ipv4.src_ip] << 28) \ & (ig_ts & 0x0FFFFFFF); } else { drop(); }}
• Packet• Header• Parser
Lyra language: Program
38
// Sequencer.lyraheader_type sequence_t{ bit[32] seq;}parser_node parse_sequence{ extract_fields(sequence);}
pipeline[SEQ] {sequencer};
algorithm sequencer { add_sequence(); routing();}
func add_sequence() { extern dict<bit[32] ip, bit[4] id>[300] filter; if (ipv4.src_ip in filter) { add_header(sequence); sequence.seq = (filter[ipv4.src_ip] << 28) \ & (ig_ts & 0x0FFFFFFF); } else { drop(); }}
• Pipeline• Algorithm
• Packet• Header• Parser
Lyra language: Program
39
// Sequencer.lyraheader_type sequence_t{ bit[32] seq;}parser_node parse_sequence{ extract_fields(sequence);}
pipeline[SEQ] {sequencer};
algorithm sequencer { add_sequence(); routing();}
func add_sequence() { extern dict<bit[32] ip, bit[4] id>[300] filter; if (ipv4.src_ip in filter) { add_header(sequence); sequence.seq = (filter[ipv4.src_ip] << 28) \ & (ig_ts & 0x0FFFFFFF); } else { drop(); }}
• Function
• Pipeline• Algorithm
• Packet• Header• Parser
Lyra language: Program
40
// Sequencer.lyraheader_type sequence_t{ bit[32] seq;}parser_node parse_sequence{ extract_fields(sequence);}
pipeline[SEQ] {sequencer};
algorithm sequencer { add_sequence(); routing();}
func add_sequence() { extern dict<bit[32] ip, bit[4] id>[300] filter; if (ipv4.src_ip in filter) { add_header(sequence); sequence.seq = (filter[ipv4.src_ip] << 28) \ & (ig_ts & 0x0FFFFFFF); } else { drop(); }}
• Function
• Pipeline• Algorithm
• Packet• Header• Parser
Lyra: A high-level data plane language & compiler
41
Lyra program
Frontend
Parser
Preprocessor
Analyzer
Backend
Chip-specific constraint
Language synthesizer
Extensibility
Lyra compiler
NPL (Trident-4)
P4 (Tofino 32Q)
P4 (Silicon One)
P4 (Tofino 64Q)One-big-pipeline model
Lyra: A high-level data plane language & compiler
42
Lyra program
Frontend
Parser
Preprocessor
Analyzer
Backend
Chip-specific constraint
Language synthesizer
Extensibility
Lyra compiler
NPL (Trident-4)
P4 (Tofino 32Q)
P4 (Silicon One)
P4 (Tofino 64Q)One-big-pipeline model
Frontend
extern list<bit[32] ip>[300] filter;if (ipv4.src_ip in filter) { add_header(sequence); sequence.seq = (filter[ipv4.src_ip] << 28) \ & (ig_ts & 0x0FFFFFFF);}else { drop();}
43
Lyra program
Frontend
extern list<bit[32] ip>[300] filter;if (ipv4.src_ip in filter) { add_header(sequence); sequence.seq = (filter[ipv4.src_ip] << 28) \ & (ig_ts & 0x0FFFFFFF);}else { drop();}
44
p1 = ipv4.src_ip in filter; add_header(sequence); tmp1 = filter[ipv4.src_ip] << 28; tmp2 = ig_ts & 0x0FFFFFFF; sequence.seq = tmp1 & tmp2; p2 = !(ipv4.src_ip in filter); drop();
Lyra program
Intermediate representation
Frontend
extern list<bit[32] ip>[300] filter;if (ipv4.src_ip in filter) { add_header(sequence); sequence.seq = (filter[ipv4.src_ip] << 28) \ & (ig_ts & 0x0FFFFFFF);}else { drop();}
45
p1 = ipv4.src_ip in filter; add_header(sequence); tmp1 = filter[ipv4.src_ip] << 28; tmp2 = ig_ts & 0x0FFFFFFF; sequence.seq = tmp1 & tmp2; p2 = !(ipv4.src_ip in filter); drop();
Lyra program
Intermediate representation
One big pipeline model
No complex statementsNo branchesHas statement dependencies
Frontend
extern list<bit[32] ip>[300] filter;if (ipv4.src_ip in filter) { add_header(sequence); sequence.seq = (filter[ipv4.src_ip] << 28) \ & (ig_ts & 0x0FFFFFFF);}else { drop();}
46
p1 = ipv4.src_ip in filter; add_header(sequence); tmp1 = filter[ipv4.src_ip] << 28; tmp2 = ig_ts & 0x0FFFFFFF; sequence.seq = tmp1 & tmp2; p2 = !(ipv4.src_ip in filter); drop();
Lyra program
Intermediate representation
One big pipeline model
No complex statementsNo branchesHas statement dependencies
Lyra: A high-level data plane language & compiler
47
Frontend
Parser
Preprocessor
Analyzer
Backend
Chip-specific constraint
Language synthesizer
Extensibility
Lyra compiler
Lyra program
NPL (Trident-4)
P4 (Tofino 32Q)
P4 (Silicon One)
P4 (Tofino 64Q)One-big-pipeline model
Lyra: A high-level data plane language & compiler
48
Backend
Chip-specific constraint
Language synthesizer
Extensibility
Lyra: A high-level data plane language & compiler
49
Backend
Chip-specific constraint
Language synthesizer
Extensibility
Portability | Compile Lyra into structured low level languages
Lyra: A high-level data plane language & compiler
50
Backend
Chip-specific constraint
Language synthesizer
Extensibility
Portability | Compile Lyra into structured low level languages
Checks whether the program can fit into the switchComposition |
Lyra: A high-level data plane language & compiler
51
Backend
Chip-specific constraint
Language synthesizer
Extensibility
Portability | Compile Lyra into structured low level languages
Checks whether the program can fit into the switchComposition |
Correctly deploy the program in the scopeExtensibility |
Lyra: A high-level data plane language & compiler
52
Backend
Chip-specific constraint
Language synthesizer
Extensibility
Portability | Compile Lyra into structured low level languages
Checks whether the program can fit into the switchComposition |
Correctly deploy the program in the scopeExtensibility |
Languages have different programming paradigms
53
Table oriented programming Procedural oriented programming
Languages have different programming paradigms
54
Table oriented programming Procedural oriented programming
table 2
table 3
table 4
table 1
P4 Program
Languages have different programming paradigms
55
Table oriented programming Procedural oriented programming
table 2
table 3
table 4
table 1
table 1
match
action 1
action 2
statement 1
statement 2
P4 Program P4 Table
Parallel
!(ipv4.src_ip in filter)
ipv4.src_ip in filteripv4.src_ip in filter
Predicate block
56
Group of statements that has the same predicate and no dependency
p2 = !(ipv4.src_ip in filter);
p1 = ipv4.src_ip in filter;
tmp1 = filter[ipv4.src_ip] << 28;add_header(sequence);
tmp2 = ig_ts & 0x0FFFFFFF;sequence.seq = tmp1 & tmp2;
drop();
Dependent
Mutual exclusive
p2 = !(ipv4.src_ip in filter);
p1 = ipv4.src_ip in filter;
tmp1 = filter[ipv4.src_ip] << 28;add_header(sequence);
tmp2 = ig_ts & 0x0FFFFFFF;sequence.seq = tmp1 & tmp2;
drop();
!(ipv4.src_ip in filter)
ipv4.src_ip in filter
Predicate block
57
Group of statements that has the same predicate and no dependency
tmp2 = ig_ts & 0x0FFFFFFF;
sequence.seq = tmp1 & tmp2;
ipv4.src_ip in filter
Mutual exclusive
Dependentadd_header(sequence);
tmp1 = filter[ipv4.src_ip] << 28;
drop();
filter tabe 1
match src_ip
action 1 (input: server_id)
action 2
tmp1 = servere_id << 28;
filter table 2
action 1
Lyra: A high-level data plane language & compiler
58
Backend
Chip-specific constraint
Language synthesizer
Extensibility
Portability | Compile Lyra into structured low level languages
Checks whether the program can fit into the switchComposition |
Correctly deploy the program in the scopeExtensibility |
Target-specific resource encoding: RMT
59
tmp2 = ig_ts & 0x0FFFFFFF;
sequence.seq = tmp1 & tmp2;add_header(sequence);
drop();
filter table 1
match src_ip
action 1 (input: server_id)
action 2
tmp1 = servere_id << 28;
filter table 2
action 1
Target-specific resource encoding: RMT
60
tmp2 = ig_ts & 0x0FFFFFFF;
sequence.seq = tmp1 & tmp2;add_header(sequence);
drop();
filter table 1
match src_ip
action 1 (input: server_id)
action 2
tmp1 = servere_id << 28;
filter table 2
action 1
Sfilter1Sfilter2
<
Target-specific resource encoding: RMT
61
tmp2 = ig_ts & 0x0FFFFFFF;
sequence.seq = tmp1 & tmp2;add_header(sequence);
drop();
filter table 1
match src_ip
action 1 (input: server_id)
action 2
tmp1 = servere_id << 28;
filter table 2
action 1
Sfilter1
0 ≤ Sfilter1≤ 31
0 ≤ Sfilter2≤ 31
Sfilter2<
Target-specific resource encoding: RMT
62
tmp2 = ig_ts & 0x0FFFFFFF;
sequence.seq = tmp1 & tmp2;add_header(sequence);
drop();
filter table 1
match src_ip
action 1 (input: server_id)
action 2
tmp1 = servere_id << 28;
filter table 2
action 1
Sfilter1
0 ≤ Sfilter1≤ 31
0 ≤ Sfilter2≤ 31
Sfilter1= 0
Sfilter2= 1
SMT solver
Sfilter2<
Target-specific resource encoding: RMT
63
tmp2 = ig_ts & 0x0FFFFFFF;
sequence.seq = tmp1 & tmp2;add_header(sequence);
drop();
filter table 1
match src_ip
action 1 (input: server_id)
action 2
tmp1 = servere_id << 28;
filter table 2
action 1
Sfilter1
0 ≤ Sfilter1≤ 31
0 ≤ Sfilter2≤ 31
Sfilter1= 0
Sfilter2= 1
SMT solver
SRAM memoryTCAM memoryPacket Header VectorTable num per stage
Sfilter2<
Lyra: A high-level data plane language & compiler
64
Backend
Chip-specific constraint
Language synthesizer
Extensibility
Portability | Compile Lyra into structured low level languages
Checks whether the program can fit into the switchComposition |
Correctly deploy the program in the scopeExtensibility |
Frontend Backend
65
Chip-specific constraint
Parser Language synthesizer
Preprocessor
Analyzer Extensibility
Lyra compiler
Lyra program
One-big-pipeline model
NPL (Trident-4)
P4 (Tofino 32Q)
P4 (Silicon One)
P4 (Tofino 64Q)
Lyra: A high-level data plane language & compiler
Evaluation
66
Program
P414 Lyra
LoC /Logic LoC Tables Actions Registers
Lyra LoC / Logic LoC
Synthesized P414 Synthesized NPL
LyraCompile
Time Tables Actions Registers
LyraCompile
Time Tables Registers
LongestCode Path
Ingress INT 308/99 9 8 0 207/62 0.987s 8 7 0 0.78s 4 0 9
Transit INT 275/66 6 6 0 193/46 0.914s 5 5 0 0.72s 2 0 4
Egress INT 282/73 7 7 0 197/47 0.897s 6 6 0 0.73s 2 0 4
Speedlight 453/351 21 23 6 194/97 1.352s 16 20 6 0.95s 9 6 18
NetCache 1137/937 96 96 40 372/153 1.909s 12 14 40 1.17s 3 40 20
NetChain 319/211 16 16 2 177/73 1.530s 13 16 2 0.85s 6 2 18
NetPaxos 241/140 6 11 5 150/69 1.158s 6 11 5 0.84s 3 5 4
flowlet_switching 195/130 8 7 2 113/43 0.91s 8 7 2 0.70s 4 2 12
simple_router 101/66 4 4 0 72/31 0.852s 4 4 0 0.67s 3 0 10
switch 4924/3876 131 363 0 4151/2563 33.6s 131 363 0 19.4s 125 0 53
Lyra can reduce resource usage
67
Program
P414 Lyra
LoC /Logic LoC Tables Actions Registers
Lyra LoC / Logic LoC
Synthesized P414 Synthesized NPL
LyraCompile
Time Tables Actions Registers
LyraCompile
Time Tables Registers
LongestCode Path
Ingress INT 308/99 9 8 0 207/62 0.987s 8 7 0 0.78s 4 0 9
Transit INT 275/66 6 6 0 193/46 0.914s 5 5 0 0.72s 2 0 4
Egress INT 282/73 7 7 0 197/47 0.897s 6 6 0 0.73s 2 0 4
Speedlight 453/351 21 23 6 194/97 1.352s 16 20 6 0.95s 9 6 18
NetCache 1137/937 96 96 40 372/153 1.909s 12 14 40 1.17s 3 40 20
NetChain 319/211 16 16 2 177/73 1.530s 13 16 2 0.85s 6 2 18
NetPaxos 241/140 6 11 5 150/69 1.158s 6 11 5 0.84s 3 5 4
flowlet_switching 195/130 8 7 2 113/43 0.91s 8 7 2 0.70s 4 2 12
simple_router 101/66 4 4 0 72/31 0.852s 4 4 0 0.67s 3 0 10
switch 4924/3876 131 363 0 4151/2563 33.6s 131 363 0 19.4s 125 0 53
Lyra can reduce resource usage
68
Program
P414 Lyra
LoC /Logic LoC Tables Actions Registers
Lyra LoC / Logic LoC
Synthesized P414 Synthesized NPL
LyraCompile
Time Tables Actions Registers
LyraCompile
Time Tables Registers
LongestCode Path
Ingress INT 308/99 9 8 0 207/62 0.987s 8 7 0 0.78s 4 0 9
Transit INT 275/66 6 6 0 193/46 0.914s 5 5 0 0.72s 2 0 4
Egress INT 282/73 7 7 0 197/47 0.897s 6 6 0 0.73s 2 0 4
Speedlight 453/351 21 23 6 194/97 1.352s 16 20 6 0.95s 9 6 18
NetCache 1137/937 96 96 40 372/153 1.909s 12 14 40 1.17s 3 40 20
NetChain 319/211 16 16 2 177/73 1.530s 13 16 2 0.85s 6 2 18
NetPaxos 241/140 6 11 5 150/69 1.158s 6 11 5 0.84s 3 5 4
flowlet_switching 195/130 8 7 2 113/43 0.91s 8 7 2 0.70s 4 2 12
simple_router 101/66 4 4 0 72/31 0.852s 4 4 0 0.67s 3 0 10
switch 4924/3876 131 363 0 4151/2563 33.6s 131 363 0 19.4s 125 0 53
Lyra can reduce resource usage
69
Program
P414 Lyra
LoC /Logic LoC Tables Actions Registers
Lyra LoC / Logic LoC
Synthesized P414 Synthesized NPL
LyraCompile
Time Tables Actions Registers
LyraCompile
Time Tables Registers
LongestCode Path
Ingress INT 308/99 9 8 0 207/62 0.987s 8 7 0 0.78s 4 0 9
Transit INT 275/66 6 6 0 193/46 0.914s 5 5 0 0.72s 2 0 4
Egress INT 282/73 7 7 0 197/47 0.897s 6 6 0 0.73s 2 0 4
Speedlight 453/351 21 23 6 194/97 1.352s 16 20 6 0.95s 9 6 18
NetCache 1137/937 96 96 40 372/153 1.909s 12 14 40 1.17s 3 40 20
NetChain 319/211 16 16 2 177/73 1.530s 13 16 2 0.85s 6 2 18
NetPaxos 241/140 6 11 5 150/69 1.158s 6 11 5 0.84s 3 5 4
flowlet_switching 195/130 8 7 2 113/43 0.91s 8 7 2 0.70s 4 2 12
simple_router 101/66 4 4 0 72/31 0.852s 4 4 0 0.67s 3 0 10
switch 4924/3876 131 363 0 4151/2563 33.6s 131 363 0 19.4s 125 0 53
Lyra can reduce resource usage
70
NetCache
nc_hdr.op == NC_READ_REQUEST
nc_hdr.op == NC_UPDATE_REPLY
check_cache_valid_actTable: check_cache_valid
set_cache_valid_actTable: set_cache_valid
Program
P414 Lyra
LoC /Logic LoC Tables Actions Registers
Lyra LoC / Logic LoC
Synthesized P414 Synthesized NPL
LyraCompile
Time Tables Actions Registers
LyraCompile
Time Tables Registers
LongestCode Path
Ingress INT 308/99 9 8 0 207/62 0.987s 8 7 0 0.78s 4 0 9
Transit INT 275/66 6 6 0 193/46 0.914s 5 5 0 0.72s 2 0 4
Egress INT 282/73 7 7 0 197/47 0.897s 6 6 0 0.73s 2 0 4
Speedlight 453/351 21 23 6 194/97 1.352s 16 20 6 0.95s 9 6 18
NetCache 1137/937 96 96 40 372/153 1.909s 12 14 40 1.17s 3 40 20
NetChain 319/211 16 16 2 177/73 1.530s 13 16 2 0.85s 6 2 18
NetPaxos 241/140 6 11 5 150/69 1.158s 6 11 5 0.84s 3 5 4
flowlet_switching 195/130 8 7 2 113/43 0.91s 8 7 2 0.70s 4 2 12
simple_router 101/66 4 4 0 72/31 0.852s 4 4 0 0.67s 3 0 10
switch 4924/3876 131 363 0 4151/2563 33.6s 131 363 0 19.4s 125 0 53
Lyra can reduce resource usage
71
NetCache
nc_hdr.op == NC_READ_REQUEST
nc_hdr.op == NC_UPDATE_REPLY
check_cache_valid_actTable: check_cache_valid
set_cache_valid_actTable: set_cache_valid
NetCache (Lyra)
check_cache_valid_act
Table: nc_hdr
set_cache_valid_act
Matchnc_hdr.op
Conclusion
72
• Lyra is the first high-level data plane language and compiler that achieves portability, extensibility and composition.
• Lyra offers a one-big-pipeline programming model and can generate runnable chip-specific code across multiple switches.
• The programs generated by Lyra use fewer hardware resources than human-written programs.
Thanks !