-
Notifications
You must be signed in to change notification settings - Fork 444
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
compiler transformations don't preserve names #259
Comments
This is a very good point. We can fix this issue by reducing it to #219, by generating @name annotations. So we have to work with @antoninbas to add support to the BMv2 JSON to give us the ability to use different names for table key fields than the program expression. Names must be unique for each table, they do not have to be globally unique. @sethfowler: this is also related to the PI generation. |
Yes, the same problem exists in PI. |
I wonder whether this issue is solved. |
It's not clear. At a minimum, I think we need to write some tests for this. |
I will also mark this as fixed. |
Since no one complained and we have more tests for p4runtime I assume this can be closed. |
(For future reference @jnfoster @cc10512 @sethfowler @cole-barefoot)
Certain compiler transformations do not preserve names. As a result, the auto-generated APIs (pd/thrift/...) for a p4 program may refer to names that appear nowhere in the p4 source code.
I'm attaching a minimal example for future reference. Here is the core of the issue:
The
ingress
control block invokes a second control blocknested
that reads from theethernet
header. The compiler implements this by creating a temporary headertmp_0_ethernet
, copyingethernet
totmp_0_ethernet
, invokingnested
withtmp_0_ethernet
, and finally copyingtmp_0_ethernet
back toethernet
(copy-in/copy-out). The relevant bits from the generated .json file are these:The important thing to notice is that the table
t
matches on the headertmp_0_ethernet
, instead ofethernet
as specified the P4 source code. As a result, the API generated for tablet
use the nametmp_0_ethernet
. The relevant bit frompd/thrift/p4_pd_rpc.thrift
is this:The text was updated successfully, but these errors were encountered: