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

Reenable bf diags build #59

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

Conversation

jafingerhut
Copy link
Contributor

No description provided.

@jafingerhut
Copy link
Contributor Author

@vgurevich I am not familiar with bf-diags stuff.

In this PR, I tried enabling the build of bf-diags, with the YAML profile looking like the one you see as the only file modified by this PR.

I get this error during the build:

CMake Error at pkgsrc/bf-diags/CMakeLists.txt:115 (message):
  One and only one of the following architectures must be specified: TOFINO,
  TOFINO2, TOFINO2M
-- Configuring incomplete, errors occurred!
  - thrift: Cmd 'cmake /home/runner/work/open-p4studio/open-p4studio -DBF-DIAGS=ON -DTOFINO=ON -DTHRIFT-SWITCH=ON -DBFRT-GENERIC-FLAGS=ON -DTHRIFT-DRIVER=ON -DTHRIFT-DIAGS=ON -DSWITCH=ON -DSAI=ON -DGRPC=ON -DTOFINO2=ON -DBFRT=ON -DTOFINO2M=OFF -DCMAKE_BUILD_TYPE='Release' -DCMAKE_INSTALL_PREFIX='/home/runner/work/open-p4studio/open-p4studio/install' -DCMAKE_LINKER='lld'' took: 0:00:34.958271, status: 1

Is the issue as simple as the error message makes it sound, i.e. the profile must enable at most one of Tofino, Tofino2, or Tofino2m, otherwise it fails?

@fruffy
Copy link
Contributor

fruffy commented Jan 29, 2025

What happens when you disable Tofino1 or Tofino2? How far do we get?

@jafingerhut
Copy link
Contributor Author

Both the Ubuntu 20.04 and 22.04 builds seem to be failing on errors like this:

/home/runner/work/open-p4studio/open-p4studio/pkgsrc/bf-diags/third-party/libcrafter/crafter/Packet.cpp:30:10: fatal error: config.h: No such file or directory
   30 | #include "config.h"
      |          ^~~~~~~~~~
compilation terminated.

There is no file config.h in any subdirectory of pkgsrc/bf-diags/third-party/libcrafter.

I compared the contents of that directory against this published version of the libcrafter library, and it has no such config.h file, either

Perhaps config.h is supposed to be generated by some build step? I do not know.

I do not know how critical it is to get bf-diags building in open-p4studio.

@vgurevich Is bf-diags intended only for building diagnostics software that one would run on a real hardware board? If so, then given the other gaps this repository currently has with respect to supporting real hardware boards, the lack of bf-diags building might be pretty low down on the list of concerns.

@fruffy
Copy link
Contributor

fruffy commented Jan 29, 2025

Both the Ubuntu 20.04 and 22.04 builds seem to be failing on errors like this:

/home/runner/work/open-p4studio/open-p4studio/pkgsrc/bf-diags/third-party/libcrafter/crafter/Packet.cpp:30:10: fatal error: config.h: No such file or directory
   30 | #include "config.h"
      |          ^~~~~~~~~~
compilation terminated.

This happens because of a change introduce in #34 and is easy to fix. We need to rename the include to p4studio_config.h to avoid ambiguities.

@vgurevich
Copy link
Contributor

@jafingerhut, you are correct! It is a matter of answering only tofino or tofino2 to the prompt Please select tofino chip type in p4studio

This prompt is quite misleading, indeed. Just so you know, pretty much all the core software (the user-space driver, BRI (that is BF RT plus BF Runtime), the compiler, the model, P4Insight (if present)) are always compiled to support all the devices, and the answer to the question above doesn't affect that.

The question does control which device bf-diags, p4-examples and switch.p4_16 are built for.

The reason is that building bf-diags and P4_14 portion of p4-examples requires a little extra effort due to the fact that they us the older-style autogenerated PD APIs, while switch.p4_16 is really many programs (profiles) packed into one and Tofino2 profiles are distinct from Tofino's (the rest, i.e. P4_16 examples can be easily built for both Tofino and Tofino2). So, the original developers decided to cut the corners a little. One of motivations was that "when you are on a real system, then you only need to compile for that specific ASIC" and "nobody cares about running bf-diags on the model".

In reality, though, bf-diags works on the model just fine and I even taught how to use it on the model in my courses. There are a number of reasons why it is useful.

So, to answer your question, the best course of action for now is to build just for one device at a time.

@fruffy fruffy linked an issue Feb 4, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bf-diags package does not build
3 participants