-
Notifications
You must be signed in to change notification settings - Fork 448
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
[P4TC] Align key components to the nearest 8-bit size #5024
base: main
Are you sure you want to change the base?
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.
Some small compilation issues
Will do another round after running more complex tests
As we discussed on the meeting, here's an example that shows the sum bug sum_example.tar.gz |
cb20ec1
to
e5a365e
Compare
e5a365e
to
889848e
Compare
The PR looks ok, but can you rebase on top of main when you have some time? |
998f749
to
ffca7b6
Compare
Hi @vbnogueira , @fruffy , Can you review the PR once? |
Sorry, we got a bit overwhelmed, but will do today |
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.
Aside from these small issues, the PR seems ok
ffca7b6
to
3f9f128
Compare
Signed-off-by: Komal, Jain <[email protected]>
3f9f128
to
1234582
Compare
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
As of now, whenever there is a key component that is a bit-type which doesn't correspond to primitive C type (u8, u16, u32, ...),
the compiler generates it as using the closest primitive C type that is larger then X in bit
For example -
dest_op here is converted into u32 like below -
This won't work, because the P4TC side is expecting the bit<24> (
dest_op
) to be contained in3 bytes
and not 4. All key components are expected to be 8-bit aligned. The new declaration for 'dest_op' would be -For all operations, compiler will call function 'getPrimitiveXX()' which will convert u8[] into primitive type (u32 or u64).
For reverse assignment operations compiler calls 'storePrimitiveXX()' which converts primitive types to u8 [ ] array.
@vbnogueira @jhsmt