Switch Code Generation Using Program Synthesis

Writing packet-processing programs for programmable switch pipelines is challenging because of their all-or-nothing nature: a program either runs at line rate if it can fit within pipeline resources, or does not run at all. It is the compiler's responsibility to fit programs into pipeline resources. However, switch compilers, which use rewrite rules to generate switch machine code, often reject programs because the rules fail to transform programs into a form that can be mapped to a pipeline's limited resources---even if a mapping actually exists. This paper presents a compiler, Chipmunk, which formulates code generation as a program synthesis problem. Chipmunk uses a program synthesis engine, SKETCH, to transform high-level programs down to switch machine code. However, naively formulating code generation as program synthesis can lead to long compile times. Hence, we develop a new domain-specific synthesis technique, slicing, which reduces compile times by 1-387x and 51x on average. Using a switch hardware simulator, we show that Chipmunk compiles many programs that a previous rule-based compiler, Domino, rejects. Chipmunk also produces machine code with fewer pipeline stages than Domino. A Chipmunk backend for the Tofino programmable switch shows that program synthesis can produce machine code for high-speed switches.

[1]  Minlan Yu,et al.  Lyra: A Cross-Platform Language and Compiler for Data Plane Programming on Heterogeneous ASICs , 2020, SIGCOMM.

[2]  Loris D'Antoni,et al.  Genesis: synthesizing forwarding tables in multi-tenant networks , 2017, POPL.

[3]  David W. Binkley,et al.  Program slicing , 2008, 2008 Frontiers of Software Maintenance.

[4]  Taegyun Kim,et al.  Autogenerating Fast Packet-Processing Code Using Program Synthesis , 2019, HotNets.

[5]  Alvin Cheung,et al.  Verified lifting of stencil computations , 2016, PLDI.

[6]  George Varghese,et al.  Compiling Packet Programs to Reconfigurable Switches , 2015, NSDI.

[7]  An Wang,et al.  Swizzle Inventor: Data Movement Synthesis for GPU Kernels , 2019, ASPLOS.

[8]  Maaz Bin Safeer Ahmad,et al.  Gradual synthesis for static parallelization of single-pass array-processing programs , 2017, PLDI.

[9]  George Varghese,et al.  CONGA: distributed congestion-aware load balancing for datacenters , 2015, SIGCOMM.

[10]  Sanjit A. Seshia,et al.  Combinatorial sketching for finite programs , 2006, ASPLOS XII.

[11]  Anirudh Sivaraman Kaushalram Designing fast and programmable routers , 2017 .

[12]  George Varghese,et al.  P4: programming protocol-independent packet processors , 2013, CCRV.

[13]  Tsutomu Sasao,et al.  Logic Synthesis and Verification , 2013 .

[14]  Srikanth Kandula,et al.  Harnessing TCPs Burstiness using Flowlet Switching , 2004 .

[15]  Loris D'Antoni,et al.  Synthesis of Fault-Tolerant Distributed Router Configurations , 2018, Proc. ACM Meas. Anal. Comput. Syst..

[16]  Nate Foster,et al.  NetCache: Balancing Key-Value Stores with Fast In-Network Caching , 2017, SOSP.

[17]  David Walker,et al.  SNAP: Stateful Network-Wide Abstractions for Packet Processing , 2015, SIGCOMM.

[18]  Nick McKeown,et al.  The Case for a Network Fast Path to the CPU , 2019, HotNets.

[19]  Anirudh Sivaraman,et al.  Language-Directed Hardware Design for Network Performance Monitoring , 2017, SIGCOMM.

[20]  Harrick M. Vin,et al.  Start-time fair queueing: a scheduling algorithm for integrated services packet switching networks , 1996, SIGCOMM '96.

[21]  Nick McKeown,et al.  The P4->NetFPGA Workflow for Line-Rate Packet Processing , 2019, FPGA.

[22]  George Varghese,et al.  Forwarding metamorphosis: fast programmable match-action processing in hardware for SDN , 2013, SIGCOMM.

[23]  George Varghese,et al.  Scaling network verification using symmetry and surgery , 2016, POPL.

[24]  Ariel Orda,et al.  dRMT: Disaggregated Programmable Switching , 2017, SIGCOMM.

[25]  Loris D'Antoni,et al.  Proving Unrealizability for Syntax-Guided Synthesis , 2019, CAV.

[26]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools (2nd Edition) , 2006 .

[27]  Armando Solar-Lezama,et al.  Sketching concurrent data structures , 2008, PLDI '08.

[28]  Rüdiger Birkner,et al.  Config2Spec: Mining Network Specifications from Network Configurations , 2020, NSDI.

[29]  Christopher W. Fraser,et al.  The Design and Application of a Retargetable Peephole Optimizer , 1980, TOPL.

[30]  Leyla Bilge,et al.  EXPOSURE: Finding Malicious Domains Using Passive DNS Analysis , 2011, NDSS.

[31]  Armando Solar-Lezama,et al.  Program synthesis by sketching , 2008 .

[32]  Jesús Manuel Almendros-Jiménez,et al.  XQuery optimization based on program slicing , 2011, CIKM '11.

[33]  Daniel Kroening,et al.  Counterexample Guided Inductive Synthesis Modulo Theories , 2018, CAV.

[34]  Fabio Somenzi,et al.  Logic synthesis and verification algorithms , 1996 .

[35]  Xiaozhou Li,et al.  NetChain: Scale-Free Sub-RTT Coordination , 2018, NSDI.

[36]  Katerina J. Argyraki,et al.  Verifying Reachability in Networks with Mutable Datapaths , 2016, NSDI.

[37]  Dinakar Dhurjati,et al.  Scaling up Superoptimization , 2016, ASPLOS.

[38]  Alvin Cheung,et al.  Packet Transactions: High-Level Programming for Line-Rate Switches , 2015, SIGCOMM.

[39]  Anirudh Sivaraman,et al.  Testing compilers for programmable switches through switch hardware simulation , 2020, CoNEXT.

[40]  Laurent Vanbever,et al.  NetComplete: Practical Network-Wide Configuration Synthesis with Autocompletion , 2018, NSDI.

[41]  Armando Solar-Lezama,et al.  Adaptive Concretization for Parallel Program Synthesis , 2015, CAV.

[42]  Kang G. Shin,et al.  The BLUE active queue management algorithms , 2002, TNET.

[43]  Alexander Aiken,et al.  Automatic generation of peephole superoptimizers , 2006, ASPLOS XII.

[44]  Sumit Gulwani,et al.  Synthesis of loop-free programs , 2011, PLDI '11.

[45]  Haoyu Song,et al.  Protocol-oblivious forwarding: unleash the power of SDN through a future-proof forwarding plane , 2013, HotSDN '13.

[46]  Jiang Zhu,et al.  Making Large Scale Deployment of RCP Practical for Real Networks , 2008, IEEE INFOCOM 2008 - The 27th Conference on Computer Communications.

[47]  Alexander Aiken,et al.  Stochastic superoptimization , 2012, ASPLOS '13.

[48]  P. Madhusudan,et al.  NetGen: synthesizing data-plane configurations for network policies , 2015, SOSR.