-
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
Getting an error while trying to implement a simple P4 PNA program. #4985
Comments
Rupesh, is this a new PNA BMv2 test program you are working on, hoping to modify the code so that it works? If so, great! Are you looking for help on why this error occurs, or do you already know the root cause? |
Yes
Looking for the help |
Is the JSON file output by the compiler something anyone should be able to reproduce from the source code and latest version of p4c source code? And the error occurs with latest behavioral-model code published? Or does the JSON file require local changes to p4c that only you have, and/or the error only occur with locally modified behavioral-model code? In either case, attaching the file pna-sample-program.json to a comment might make it easier for someone else to reproduce the issue. |
Not to mention that there is a pretty strong chance that this is caused by an invalid / unsupported JSON file. |
Yes
Yes
No local changes are made in this case |
JSON file: |
The expression for the conditional present in the JSON is not supported: "conditionals" : [
{
"name" : "node_3",
"id" : 0,
"source_info" : {
"filename" : "pna-demo-recirculation.p4",
"line" : 96,
"column" : 12,
"source_fragment" : "is_recirculated"
},
"expression" : {
"type" : "field",
"value" : ["pna_main_input_metadata", "recirculated"]
},
"false_next" : null,
"true_next" : "MainControlImpl.send_packet_table"
}
] The This seems to be an issue in the PNA p4c backend, as I would expect such a simple program to work well for simple_switch / v1model. You can probably write the same program for v1model, and check what the JSON looks like (and make sure it is accepted by simple_switch). I think this issue should be transferred to p4c. |
(pna_main_input_metadata.recirculated == (bool) 1) didn't work.
Yes.
Ok |
I didn't suggest modifying the P4 program, that was very unlikely to work. JSON generation needs to be fixed. |
Yes, after changing to explicit conversion in the JSON, it is working fine.
|
I am having the same problem with the below PSA program, and it is working after changing the JSON as per the above suggestion. |
The PSA back end for BMv2 is probably in a similarly unfinished state as the PNA back end for BMv2. There are many, many small simple PSA programs that either do not compile using p4c-bm2-psa, or they compile but do not execute correctly. I would recommend_not_ using the PSA back end for BMv2 as a reference for how to do things. The v1model back end for BMv2 is by (I believe) a wide margin the most mature, featureful, and well tested open source p4c back end. |
I guess now that the Tofino back end is open source, it might beat the v1model back end now, by those measures. I would still recommend referring to how the v1model back end does things when trying to learn reasonable ways to work with BMv2 as the target. |
Ok. Thanks everyone for very quick response :) |
Should I close this issue or leave it open till the bug is fixed? |
I think it is fine to leave the issue open until the bug is fixed. |
@rupesh-chiluka-marvell Are you interested in implementing a fix for this in the PNA back end? |
Yes. I would like to 👍. |
Great! Feel free to make a PR at any time. |
Program:
Ouptut:
The text was updated successfully, but these errors were encountered: