-
Notifications
You must be signed in to change notification settings - Fork 449
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
[#4614] Unconditionally copy dpdk
p4include files to the binary directory
#4615
Conversation
check-p4
testing targetdpdk
p4include files to the binary directory
@@ -539,18 +539,13 @@ add_custom_target(update_includes ALL | |||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${P4C_SOURCE_DIR}/p4include/*.p4 ${P4C_BINARY_DIR}/p4include | |||
COMMAND ${CMAKE_COMMAND} -E make_directory ${P4C_BINARY_DIR}/p4include/bmv2 | |||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${P4C_SOURCE_DIR}/p4include/bmv2/psa.p4 ${P4C_BINARY_DIR}/p4include/bmv2 | |||
COMMAND ${CMAKE_COMMAND} -E make_directory ${P4C_BINARY_DIR}/p4include/dpdk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a TODO pointing to #4614 that we should clean this up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By "clean this up," do you mean changing the tests' <pna.p4> includes to either <bmv2/pna.p4> or <dpdk/pna.p4>? Or do you mean that check-p4 should not run these dpdk or bmv2 tests at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think both cases will end up being the result of resolving #4614. We can also put the TODO as deciding whether to fully disable these tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any downside to running them under check-p4? My understanding now is that for all of the bmv2 and dpdk tests, check-p4 is just checking the frontend-generated and midend-generated IR and/or diagnostics, so they would still be useful to run. However if we are checking what is generated by e.g. the dpdk pna backend, then it wouldn't make sense to run the dpdk pna tests under check-p4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it definitely makes sense to at least make the includes more verbose. I can try doing that in this PR later.
@fruffy Done.
|
Hmm, I just noticed that we also have p4include/pna.p4 in addition to the dpdk-specific p4include/dpdk/pna.p4. As far as I understand, it doesn't make sense to include the dpdk-specific |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! This a great cleanup. @jafingerhut could you also take a look?
@@ -1,5 +1,5 @@ | |||
#include <core.p4> | |||
#include <bmv2/psa.p4> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these changes from bmv2/psa
to dpdk/psa
because the file is DPDK-related?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testdata/p4_16_samples/psa-example-select_tuple-wc.p4 was added in a dpdk-related PR (#2836), so the intent was likely to include dpdk/psa.p4. However, testdata/p4_16_samples/psa-example-select_tuple-wc.p4 contained #include <psa.p4>
, so bmv2/psa.p4 was actually included.
FYI, in case this isn't obvious to everyone: It is expected that different target devices that implement PSA, or that implement PNA, architectures can customize the bit widths of several types, e.g. PortId_t, for that particular target device. Most P4 programs written for such an architecture will likely compile and run tests in this repo fine regardless of the particular value for those bit widths. Some implementations have chosen to make additional customizations to pna.p4, e.g. dpdk/pna.p4 has additional changes to some parameters of some extern methods. As @kfcripps pointed out earlier, many particular test programs might not be using such methods, and those will likely work identically regardless of which version of the pna.p4 include file they use. While we could consider trying to divide up PNA architecture test programs into these 3 categories: (a) ones that must use a BMv2-specific pna.p4 include file (assuming one exists in the near future, as appears likely given other PRs in the works) Note that if in the future the DPDK-specific pna.p4 include file were to change (as an example, but this is not specific to DPDK), it might require moving test programs around that were formerly in group (c) into group (b). I am not personally strongly against such an approach, but would like to suggest that it might be less busy-work for everyone involved if we DO NOT attempt to have category (c) tests at all. That is, every test program for the PNA architecture would be focused solely on testing one particular target. If we take that approach, yes, then each target-implementer of an architecture gets complete control over what their test programs are, and all of them would include their target-specific version of the pna.p4 include file, and it would be up to that team of people to decide exactly what their test programs test, vs. what they do not. That approach also makes it easier to manage test programs in the currently-common situation that different targets implement different subsets of an architecture specification. |
If a test is already in group (c) then why would changing the dpdk-specific pna.p4 file require moving the test to group (b)?
I don't really have a preference between always including the target-specific pna.p4 vs. sometimes including the generic pna.p4 file so I'll let you two decide @fruffy @jafingerhut and then I can update the includes touched by this PR accordingly. |
@kfcripps asked: "If a test is already in group (c) then why would changing the dpdk-specific pna.p4 file require moving the test to group (b)?" Because the P4 program being tested uses some feature in the dpdk-specific pna.p4 file that the DPDK developers decided to modify, similarly to how at some point in the past they decided to modify the signatures of some extern methods to take additional parameters. They might decide to do so again in the future (or another target might), and if any test P4 programs used that method, it would need to be updated to continue compiling and running for the target. |
@jafingerhut But if a test is in group (c), that means it's not including the dpdk-specific pna.p4 file, and therefore not using some dpdk-specific feature, right? |
@jafingerhut Do you mean that a test might need to be moved from group (c) to (b) if:
? |
@fruffy @jafingerhut Should I merge this as is? Or shall I remove all |
I lost track of the discussion. I do like the shared approach solely for the reason that we are looking into developing a BMv2 PNA target #4606 and can reuse all the programs with generic includes as test programs. The alternative to this approach, without duplicating test programs, is to use |
Ok, I will merge this as-is if the changes look ok to you @jafingerhut? |
@kfcripps I will approve this PR in a moment. Please go ahead and we can work out later if there are more changes we want to make. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@jafingerhut @fruffy Thanks! |
Moves all psa and pna dpdk tests top4_16_pna_samples/
andp4_16_psa_samples/
so that thecheck-p4
testing target does not run them.Unconditionally copy
dpdk
p4include files to the binary directory so that they will be available for thecheck-p4
testing target even when the dpdk backend is disabled.Fixes #4614