P2GO: P4 Profile-Guided Optimizations

Patrick Wintermeyer, Maria Apostolaki, Alexander Dietmüller, Laurent Vanbever

Research output: Chapter in Book/Report/Conference proceedingConference contribution

14 Scopus citations


Programmable devices allow the operator to specify the data-plane behavior of a network device in a high-level language such as P4. The compiler then maps the P4 program to the hardware after applying a set of optimizations to minimize resource utilization. Yet, the lack of context restricts the compiler to conservatively account for all possible inputs - including unrealistic or infrequent ones - leading to sub-optimal use of the resources or even compilation failures. To address this inefficiency, we propose that the compiler leverages insights from actual traffic traces, effectively unlocking a broader spectrum of possible optimizations. We present a system working alongside the compiler that uses traffic-awareness to reduce the allocated resources of a P4 program by: (i) removing dependencies that do not manifest; (ii) adjusting table and register sizes to reduce the pipeline length; and (iii) offloading parts of the program that are rarely used to the controller. Our prototype implementation on the Tofino switch automatically profiles the P4 program, detects opportunities and performs optimizations to improve the pipeline efficiency. Our work showcases the potential benefit of applying profiling techniques used to compile general-purpose languages to compiling P4 programs.

Original languageEnglish (US)
Title of host publicationHotNets 2020 - Proceedings of the 19th ACM Workshop on Hot Topics in Networks
PublisherAssociation for Computing Machinery, Inc
Number of pages7
ISBN (Electronic)9781450381451
StatePublished - Nov 4 2020
Externally publishedYes
Event19th ACM Workshop on Hot Topics in Networks, HotNets 2020 - Virtual, Online, United States
Duration: Nov 4 2020Nov 6 2020

Publication series

NameHotNets 2020 - Proceedings of the 19th ACM Workshop on Hot Topics in Networks


Conference19th ACM Workshop on Hot Topics in Networks, HotNets 2020
Country/TerritoryUnited States
CityVirtual, Online

All Science Journal Classification (ASJC) codes

  • Computer Networks and Communications


  • compilation
  • optimization
  • p4
  • profile-guided
  • programmable data plane
  • programmable networks
  • resource allocation


Dive into the research topics of 'P2GO: P4 Profile-Guided Optimizations'. Together they form a unique fingerprint.

Cite this