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

Contributing Intel Tofino compiler backend to p4c #4964

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open

Conversation

hanw
Copy link
Contributor

@hanw hanw commented Oct 17, 2024

This pull request introduces the compiler backend for Intel Tofino 1 and Tofino 2 programmable switch ASICs, licensed under the Apache License 2.0. Due to the large number of files, this PR has been divided into a series of commits, organized primarily by directory structure.

To build the backend, use the -DENABLE_TOFINO=ON flag during bootstrapping. This flag is enabled by default.

Please note that this PR contains only the source code for the Tofino backend and does not include additional regression tests. A separate PR will be submitted to provide a set of PTF and STF tests for this backend.

A big thank you to all the team members who contributed to this compiler -- you know who you are!

-- Glen, Prathima, Han

hanw and others added 28 commits October 16, 2024 09:04
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
…odel architectures

Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
…na translation

Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Core algorithms to allocate resource in MAU

Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Core algorithms for Parser and Deparser allocation

Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
clot stands for Checksum-Length-Offset-Tag

Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
V2 algorithm for phv allocation

Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Glen Gibb <[email protected]>
Co-authored-by: Prathima Kotikalapudi <[email protected]>
Co-authored-by: Han Wang <[email protected]>
@fruffy fruffy added the tofino Topics related to the Tofino switch and back end. label Oct 17, 2024
Copy link
Collaborator

@fruffy fruffy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exciting!

I would consider using something like https://github.com/p4lang/p4c/blob/main/backends/p4tools/cmake/common.cmake#L16 to fix the Z3 issues. At least it has worked well in the tools back end. We can put that script into top-level cmake folder as Z3.cmake.

@@ -35,6 +35,7 @@ set (CMAKE_USE_RELATIVE_PATHS 1)

OPTION (ENABLE_DOCS "Build the documentation" OFF)
OPTION (ENABLE_GTESTS "Enable building and running GTest unit tests" ON)
OPTION (ENABLE_TOFINO "Build the TOFINO backend (required for the full test suite)" ON)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would disable this by default and only build Tofino on the Ubuntu 22.04 Github actions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thing is that this backend is really... large :) So not all breaking changes might be quite non-trivial :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thing is that this backend is really... large :) So not all breaking changes might be quite non-trivial :)

This might actually be a good thing. bf-p4c pushes the limits of what you can do as a back end. So if we introduce breaking changes it can act as a canary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it has both pros and cons. I am talking mostly about the amount of possible changes required if we'd introduce, say, some IR change or something like this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tofino Topics related to the Tofino switch and back end.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants