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

Support for 128 bit constants in dpdk backend #5034

Closed
wants to merge 10 commits into from

Conversation

maheswari-s
Copy link
Contributor

Added support for 128 bit constants usage in dpdk backend
Updated testcases and outputs

This PR overwrites the PR #5009

Copy link
Contributor

@psivanup psivanup left a comment

Choose a reason for hiding this comment

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

Looks fine

@maheswari-s
Copy link
Contributor Author

@fruffy , @syogender, @psivanup, @jafingerhut : Please review this PR for 128 bit implementation.
I addressed the issue raised by Andy in PR #5009. Addressed the issue as discussed with Cristian.

@fruffy fruffy added the dpdk Topics related to the DPDK back end label Nov 26, 2024
@jafingerhut
Copy link
Contributor

It looks like some expected output files are missing, according to the failure of the test-p4c-debian / test-ubuntu22 test report. Can you please add those?

Copy link

@syogender syogender left a comment

Choose a reason for hiding this comment

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

Looks Good

@maheswari-s
Copy link
Contributor Author

@fruffy , @syogender, @psivanup, @jafingerhut : All checks have passed. Please review and approve.

@@ -37,6 +37,8 @@ limitations under the License.

namespace P4::DPDK {

static const int SupportedBitWidth = 128;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
static const int SupportedBitWidth = 128;
namespace DpdkConstants {
static constexpr int SupportedBitWidth = 128;
}

@@ -151,15 +151,13 @@ bool reservedNames(P4::ReferenceMap *refMap, const std::vector<cstring> &names,
return true;
}

/// Update bitwidth of Metadata fields to 32 or 64 bits if it 8-bit aligned.
/// The DPDK pipeline requirement is all header/metadata fields to be multiple of 8bits.
Copy link
Collaborator

Choose a reason for hiding this comment

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

The BMv2 back end has a pass that throws an error when a type does not have the correct bit-width. Do the same thing here? Also isn't this restriction for total width? What if you have a 4-bit version field like in the IPv4 header?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I discussed with Cristian and he told that all header/metadata/variables should be multiple of 8bits. There may be sub fields within 8bit like IPV4 headers. That compiler handles as the 8bit are finally covered and all headers are always multiple of 8bits.

If user creates structure, for example with 3 fields as 24bits, 3bits, 32bits, here the 3bits field is not supported. For this, Cristian advises to issue error. But in compiler, i need some more time to do that. So, as of now, i am rounding to nearest 8bit multiples if fields are odd like in this example. In case if fields are 8bit, 2bits, 3bits, 1bit, 2bits, here compiler can pack the last 4fields into one 8bit field and will not round them individually.

I will address the error issuance separately. Currently, rounding to nearest 8bits is fine.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I will address the error issuance separately. Currently, rounding to nearest 8bits is fine.

Will this lead to incorrect processing? Or does it just waste resources? If it is the former it is a bug and should not be merged.

The BMv2 back end checks for headers like this fwiw: https://github.com/p4lang/p4c/blob/main/backends/bmv2/common/header.cpp#L257

@@ -0,0 +1,3 @@
psa-dpdk-128bitCast_error.p4(55): [--Werror=overlimit] error: DPDK target supports up-to 64-bit immediate values, 80w0xffffbbbb12345342aaaa exceeds the limit
Copy link
Contributor

@jafingerhut jafingerhut Dec 2, 2024

Choose a reason for hiding this comment

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

I am a bit confused by this error message. These changes are to enable support in DPDK back end for 128-bit immediate values, yes?

If so, then the error message seems misleading. It seems best either to (a) support this assignment, or (b) give a more precise error message, whatever the restriction might actually be. Is the restriction given these changes something like "DPDK target supports immediate values that are up to 64-bit, and also exactly 128-bit, but no other sizes. 80w0xffffbbbb12345342aaaa is not a supported size" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes Andy. Constants supported are within 64bits or only 128bits. I rephrased the error as you have given. Please check now.

@jafingerhut
Copy link
Contributor

Maheswari, we currently do not have any automated tests in this repo for trying to pass packets through P4-DPDK that consume the output of p4c-dpdk and check whether it seems to be operating correctly while processing packets. The .spec files output for the test programs here are a bit tedious for me to check by hand. Have you or someone else checked the .spec output files by hand and they look correct to you? Or have you run the .spec and other p4c-dpdk output files on a P4-DPDK software switch and validated that it is behaving as the P4 source program says it should?

@fruffy
Copy link
Collaborator

fruffy commented Dec 5, 2024

Maheswari, we currently do not have any automated tests in this repo for trying to pass packets through P4-DPDK that consume the output of p4c-dpdk and check whether it seems to be operating correctly while processing packets. The .spec files output for the test programs here are a bit tedious for me to check by hand. Have you or someone else checked the .spec output files by hand and they look correct to you? Or have you run the .spec and other p4c-dpdk output files on a P4-DPDK software switch and validated that it is behaving as the P4 source program says it should?

Note that we had a CI workflow to run DPDK PTF tests, but we disabled it: https://github.com/p4lang/p4c/blob/main/.github/workflows/disabled/ci-dpdk-ptf-p4testgen-tests.yml

The tests were generated by P4Testgen because we didn't have any packet tests available.

The reason we disabled it was that the DPDK test harness had stability problems and we were unable to find the root cause. Still, I do not think there is much work left to do to reinstate this.

@jafingerhut
Copy link
Contributor

Maheswari, we currently do not have any automated tests in this repo for trying to pass packets through P4-DPDK that consume the output of p4c-dpdk and check whether it seems to be operating correctly while processing packets. The .spec files output for the test programs here are a bit tedious for me to check by hand. Have you or someone else checked the .spec output files by hand and they look correct to you? Or have you run the .spec and other p4c-dpdk output files on a P4-DPDK software switch and validated that it is behaving as the P4 source program says it should?

Note that we had a CI workflow to run DPDK PTF tests, but we disabled it: https://github.com/p4lang/p4c/blob/main/.github/workflows/disabled/ci-dpdk-ptf-p4testgen-tests.yml

The tests were generated by P4Testgen because we didn't have any packet tests available.

The reason we disabled it was that the DPDK test harness had stability problems and we were unable to find the root cause. Still, I do not think there is much work left to do to reinstate this.

Yes, automated CI tests would be the ideal long term solution.

Even in the absence of those, it seems reasonable to ask whether any manual tests have been run on these particular changes, to look for any bugs that such testing might find.

inout pna_main_output_metadata_t ostd)
{
action a1(bit<73> x) {
hdr.custom.f128 = (bit<128>) x;
Copy link

@digesh099 digesh099 Dec 6, 2024

Choose a reason for hiding this comment

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

@maheswari-s @jafingerhut - I hope this is the line fix is addressing. I can manually run in my dpdk setup and post the packet processing result. please provide the correct case if this is error case

Copy link
Contributor

Choose a reason for hiding this comment

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

That is the line of code that the last commit to this PR is fixing. The DASH test program has several expressions involving 128-bit constants that this PR is also addressing.

@maheswari-s
Copy link
Contributor Author

Maheswari, we currently do not have any automated tests in this repo for trying to pass packets through P4-DPDK that consume the output of p4c-dpdk and check whether it seems to be operating correctly while processing packets. The .spec files output for the test programs here are a bit tedious for me to check by hand. Have you or someone else checked the .spec output files by hand and they look correct to you? Or have you run the .spec and other p4c-dpdk output files on a P4-DPDK software switch and validated that it is behaving as the P4 source program says it should?

@jafingerhut, @fruffy, we have done the execution test using dpdk-pipeline and it works fine. We found a syntax issue in generated .spec file and that is also corrected and i pushed the changes now. You can review and approve it confidently.

We have the execution test artifacts. If that can be merged to DPDK test base, we can do that. Please advise or give us pointers to whom we need to contact for this. Thanks.

@jafingerhut
Copy link
Contributor

@maheswari-s It looks like some expected output files for test programs need updating in order for the CI tests to pass.

@jafingerhut
Copy link
Contributor

DCO check is failing, perhaps starting with most recent commit?

@maheswari-s
Copy link
Contributor Author

@jafingerhut , I missed to add the signoff-by line so that the DCO check is failing. I just now added in the commit message and did a force push. But still it is failing. Any idea how to make this check to pass?

@jafingerhut
Copy link
Contributor

@jafingerhut , I missed to add the signoff-by line so that the DCO check is failing. I just now added in the commit message and did a force push. But still it is failing. Any idea how to make this check to pass?

If you click on the "Details" link to the right of the failing DCO check, there are a list of step-by-step instructions, with specific git commands and their arguments, that you can try to use in updating this PR, such that it may pass the DCO check after you run those commands.

If those do not work, my best advice is to create a new PR, one where all commits are correctly signed, and delete this PR.

@maheswari-s
Copy link
Contributor Author

@jafingerhut, I used the first method given in that link. Now it passed. Please check.

Sosutha and others added 10 commits December 19, 2024 10:24
Signed-off-by : Sosutha Sethuramapandian <[email protected]>

* Added support for 128 bit constants usage in dpdk backend
* Updated testcases and outputs

Signed-off-by: Maheswari Subramanian <[email protected]>
Signed-off-by: Maheswari Subramanian <[email protected]>
Signed-off-by: Maheswari Subramanian <[email protected]>
Signed-off-by: Maheswari Subramanian <[email protected]>
Signed-off-by: Maheswari Subramanian <[email protected]>
- The field name inside the compiler generated header is changed from
  'tmp' to 'inter'.
- The unnecessary extra string 'header' is removed from the variable
  instances.
[email protected]>

I, Maheswari Subramanian <[email protected]>, hereby add my Signed-off-by to this commit: 2d4d3db

Signed-off-by: Maheswari Subramanian <[email protected]>
@jafingerhut
Copy link
Contributor

Closing this PR, as #5074 is preferred over this one.

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

Successfully merging this pull request may close these issues.

7 participants