Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install Tofino P4 compiler as "bf-p4c" not "p4c" #50

Open
vgurevich opened this issue Jan 25, 2025 · 3 comments
Open

Install Tofino P4 compiler as "bf-p4c" not "p4c" #50

vgurevich opened this issue Jan 25, 2025 · 3 comments
Labels
enhancement New feature or request

Comments

@vgurevich
Copy link
Contributor

The current version of p4studio installs Tofino P4 compiler as $SDE_INSTALL/bin/p4c.

This is incorrect and breaks a lot of things (starting with the standard cmake files for P4 code compilation). The proper name is $SDE_INSTALL/bin/bf-p4c.

The rationale is that Intel Tofino compiler is not a pure p4c for a given target (Tofino). That executable is actually called $SDE_INSTALL/bin/p4c-barefoot. Instead p4c is a compiler driver, i.e. a Python script that calls the compiler, the assembler and a number of other scripts to perform the compilation. Moreover, the set of parameters it accepts is different.

Using the name p4c creates a lot of confusion and often leads to very frustrating errors, especially in cases where people have both Tofino compiler and the 'regular' p4c installed.

@ChrisDodd
Copy link

p4c and bf-p4c are identical python scripts, so it shouldn't matter which one you install (or what you install it as). Both will read .cfg files in the install directory to figure out what the supported/installed targets are -- p4c.tofino.cfg will specify where to find p4c-barefoot for tofino targets.

@vgurevich
Copy link
Contributor Author

@ChrisDodd -- I agree that technically the name should not matter. However,

  1. Please, see this report on how the renaming broke the official scripts that build P4 code
  2. As I explained above, re-using the name p4c creates a lot of confusion every time someone has both the Intel compiler and the "regular" p4c in their path. We had tons of such support requests where the people would send logs that made absolutely no sense. Once the compiler was renamed, they all went away.

@fruffy
Copy link
Contributor

fruffy commented Jan 26, 2025

@fruffy fruffy added enhancement New feature or request bug Something isn't working and removed bug Something isn't working labels Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants