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

P4C arm64/aarch64 support #4390

Closed
fruffy opened this issue Feb 5, 2024 · 14 comments · Fixed by #4393
Closed

P4C arm64/aarch64 support #4390

fruffy opened this issue Feb 5, 2024 · 14 comments · Fixed by #4393
Assignees
Labels
enhancement This topic discusses an improvement to existing compiler code. infrastructure Topics related to code style and build and test infrastructure.

Comments

@fruffy
Copy link
Collaborator

fruffy commented Feb 5, 2024

This increasingly comes up as a topic. For example, users with M1 MacBook would like to try out the compiler but can not get it to work. It might not be too much effort to fix the issues causing compiler errors.

@fruffy fruffy added the enhancement This topic discusses an improvement to existing compiler code. label Feb 5, 2024
@fruffy fruffy self-assigned this Feb 5, 2024
@jafingerhut
Copy link
Contributor

I have not tried to compile it in macOS ever (neither Intel nor arm64 processors), but I have successfully compiled p4c and other open source P4 dev tools on Ubuntu Linux for arm64 on an Apple Silicon Mac, using UTM as the virtualization software to run Ubuntu Linux arm64, and some updates I made to my install-p4dev-v7.sh script so that it installs Z3 from source code : https://github.com/jafingerhut/p4-guide/blob/master/bin/README-install-troubleshooting.md#quick-instructions-for-successful-install-script-run

@vlstill
Copy link
Contributor

vlstill commented Feb 5, 2024

Do we have access to CI running the M-series HW? It seems there should be one -- https://github.blog/2023-10-02-introducing-the-new-apple-silicon-powered-m1-macos-larger-runner-for-github-actions/. Ideally we are looking for a volunteer with M-series MacBook to do the porting anyway, as fixing this just based on CI will be very painful.

I think we as p4c community should decide what platforms make sense to be supported -- from the readme even older x64-based macOS is "unofficial". So do we want to add M-series Apple products? Do we want to make them official? It is a major platform... As a side note, since the issue topic mentions aarch64 in general, we do support Ubuntu and Ubuntu has official aarch64 version, do we want to support that too?

@fruffy
Copy link
Collaborator Author

fruffy commented Feb 5, 2024

I have not tried to compile it in macOS ever (neither Intel nor arm64 processors), but I have successfully compiled p4c and other open source P4 dev tools on Ubuntu Linux for arm64 on an Apple Silicon Mac, using UTM as the virtualization software to run Ubuntu Linux arm64, and some updates I made to my install-p4dev-v7.sh script so that it installs Z3 from source code : https://github.com/jafingerhut/p4-guide/blob/master/bin/README-install-troubleshooting.md#quick-instructions-for-successful-install-script-run

This is is useful, thanks. I have been thinking that we should incorporate some of your install scrips into the compiler at some point. At least the parts concerning the compiler. It would be nice to have a one-shot install script for the common development environments.

There seems to be issues with using boost, have you run into these? Or is Z3 the only problem?

I think we as p4c community should decide what platforms make sense to be supported -- from the readme even older x64-based macOS is "unofficial". So do we want to add M-series Apple products? Do we want to make them official? It is a major platform... As a side note, since the issue topic mentions aarch64 in general, we do support Ubuntu and Ubuntu has official aarch64 version, do we want to support that too?

Yeah I have also been thinking about this. The macOS support is unofficial because, while a lot of P4C developers use Linux environments, students often prefer MacBooks to learn about P4 and P4C. Supporting macOS reduces the friction of outreach somewhat. We could make it one of the nightly CI runs if the work required is low.

@jafingerhut
Copy link
Contributor

@fruffy asked: "There seems to be issues with using boost, have you run into these? Or is Z3 the only problem?"

I have not noticed any issued with Ubuntu 20.04, 22.04, or 23.04 (arm64) when running my install-p4dev-v7.sh script. In all cases, the p4c/etc. executables that result enable all but about 15 of the make check tests to pass in p4c/build, which is close to the results I see on x86_64 Ubuntu systems (and Fedora).

@fruffy
Copy link
Collaborator Author

fruffy commented Feb 5, 2024

Does this also include support for BMv2?

@jafingerhut
Copy link
Contributor

My install-p4dev-v7.sh script builds all of these things from source code, both on x86_64 and arm64, with good test results (minus the very few failed tests I mentioned earlier): https://github.com/jafingerhut/p4-guide/blob/master/bin/install-p4dev-v7.sh#L405-L419

@fruffy
Copy link
Collaborator Author

fruffy commented Feb 5, 2024

Great, thanks.

@fruffy
Copy link
Collaborator Author

fruffy commented Feb 6, 2024

It looks like the M1 runners are not free yet:

actions/runner-images#8439 (comment)

@asl
Copy link
Contributor

asl commented Feb 14, 2024

What are M1 problems? I am on M1 laptop and everything works for me somehow (besides obvious Linux-y things like ebpf that requires linux kernel headers, etc.).

So, if there is a particular configuration for me to try, I can do it

@jafingerhut
Copy link
Contributor

@asl Fabian can confirm, but I believe this issue is primarily focused on the topic of doing CI testing of p4c on arm64, but the free arm64 hosts available to us right now via Github actions do not have enough memory on the arm64 hosts.

I have also run p4c on arm64 (Apple Silicon Mac) with no trouble, most tests passing just fine.

@asl
Copy link
Contributor

asl commented Feb 14, 2024

@jafingerhut Yeah, this is what I wanted to know as "but can not get it to work". @fruffy – any further information?

@fruffy
Copy link
Collaborator Author

fruffy commented Feb 15, 2024

What are M1 problems? I am on M1 laptop and everything works for me somehow (besides obvious Linux-y things like ebpf that requires linux kernel headers, etc.).

How do you install your dependencies? Students I work with ostensibly had issues with boost and Protobuf, but I can not check for issues without CI support. For what it is worth using Andy's scripts worked for them.

@asl
Copy link
Contributor

asl commented Feb 15, 2024

How do you install your dependencies? Students I work with ostensibly had issues with boost and Protobuf, but I can not check for issues without CI support. For what it is worth using Andy's scripts worked for them.

Homebrew works reasonable well. I think I had issues with protobuf from there as it is a bit non-trivial to provide protobuf in non-standard location (from homebrew) within present build system, but the one installed via FetchContent works fine. On older macs the problem was that Apple-shipped Flex / Bison were outdated, so one would need to provide custom paths for these, but I think this is already fixed.

I can try to replicate some fresh setup from scratch if you're having some particular configuration in mind for me to try

@fruffy
Copy link
Collaborator Author

fruffy commented Feb 16, 2024

I can try to replicate some fresh setup from scratch if you're having some particular configuration in mind for me to try

No need thanks! I will just wait until the M1 runner is widely available. It's good to know that the FetchContent version of Protobuf works.

@fruffy fruffy added the infrastructure Topics related to code style and build and test infrastructure. label Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This topic discusses an improvement to existing compiler code. infrastructure Topics related to code style and build and test infrastructure.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants