-
Notifications
You must be signed in to change notification settings - Fork 451
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
Pass to get rid of action_run() calls #5053
base: main
Are you sure you want to change the base?
Conversation
bd15e5c
to
7976cfe
Compare
7976cfe
to
b2f45cc
Compare
89e94d6
to
a26e2e0
Compare
96ece1f
to
e448341
Compare
e448341
to
4697edd
Compare
I've added the ability to use |
f544827
to
2f64c87
Compare
#include <core.p4> | ||
#include <v1model.p4> | ||
|
||
@command_line("--preferSwitch") |
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.
This option will only be valid for the p4test back end but this is also a v1model program for BMv2.
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.
P4Testgen fails because it tries to execute this program but does not support this option.
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 not quite sure such pragma is a good approach as this essentially adds a direct and unctrollable way to change internal compiler state. Even more, the option might be not supported at all, spelled differently, might not be used at all, etc. Why cannot some pragma with semantics be used instead?
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.
Since the filename does not end in -bmv2.p4
it is not a valid bmv2 program (like many other tests in this directory) so should not be used by testgen (and in fact is not). So P4Testgen should not be looking at this file (and as far as I can tell, it does not -- all the testgen failures are with other source files).
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.
P4Testgen checks programs which include v1model.p4
: https://github.com/p4lang/p4c/blob/main/backends/p4tools/modules/testgen/targets/bmv2/test/P4Tests.cmake#L9
Which, imho, is the right way to do because any program that includes this should run on BMv2 or others.
The other failures is caused by this line p4c/backends/p4tools/modules/testgen/targets/tofino/test/p4-programs/tna_simple_switch.p4 Line 33 in c67d1fd
This is also not a supported option for P4Testgen but the pragma is still parsed as input. |
I see three possible ways to solve this:
|
This line was not touched by this change, so there's no change here |
It's existing code that had no impact but is now active because of https://github.com/p4lang/p4c/pull/5053/files#diff-b033ed467d2767be363300d09ff13ac0a990d2e0de7464b732d9b29888da81a1R54. |
- per-target selectable support, though most should want it Signed-off-by: Chris Dodd <[email protected]>
2f64c87
to
f5d6769
Compare
- introduce new metadata set in the actions of the table Signed-off-by: Chris Dodd <[email protected]>
This is a general midend pass for any target that does not support
action_run
directly. It rewrites the actions in a table that uses action_run to set a newly introduced metadata tmp enum that records which action was run, and changes the switch statement to use that.It is kind-of logically the reverse of EliminateSwitch, which converts switch statements that don't use
action_run()
into ones that do, so it would never make sense to use both passes for a backend.Need to update p4test so we can select which pass(es) to run in a test by some annotation in the test program to better allow testing this.