-
Notifications
You must be signed in to change notification settings - Fork 446
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
Conversation
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.
Looks fine
@fruffy , @syogender, @psivanup, @jafingerhut : Please review this PR for 128 bit implementation. |
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? |
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.
Looks Good
28de38b
to
3625864
Compare
@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; |
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.
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. |
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.
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?
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 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.
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 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 |
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 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" ?
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.
Yes Andy. Constants supported are within 64bits or only 128bits. I rephrased the error as you have given. Please check now.
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; |
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.
@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
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.
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.
@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. |
@maheswari-s It looks like some expected output files for test programs need updating in order for the CI tests to pass. |
DCO check is failing, perhaps starting with most recent commit? |
bac7014
to
dac8c5c
Compare
@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. |
@jafingerhut, I used the first method given in that link. Now it passed. Please check. |
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]>
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.
Signed-off-by: Maheswari Subramanian <[email protected]>
…[email protected]> I, Maheswari Subramanian <[email protected]>, hereby add my Signed-off-by to this commit: 2d4d3db Signed-off-by: Maheswari Subramanian <[email protected]>
6a0a99b
to
31ecfb0
Compare
Closing this PR, as #5074 is preferred over this one. |
Added support for 128 bit constants usage in dpdk backend
Updated testcases and outputs
This PR overwrites the PR #5009