-
Notifications
You must be signed in to change notification settings - Fork 449
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
p4c
should prohibit different controllable entities having the same control-plane name
#4651
Comments
Similarly, the following P4 program:
gets transformed into:
so we end up with two actions defined in the same scope that have the same local name ( |
@kfcripps This behavior has existed in p4c for quite some time. I will send links to some other p4c issues that I am aware of from years back with some discussion on the topic, but if I am recalling correctly, the reason that p4c internally takes one action and makes multiple copies of it, one for each table it is used within, has its motivation in allowing each of those copies to be optimized independently of each other, based upon the context in which the table invoking it is applied. Here is the oldest issue I could find with the most discussion on it: Here are some later issues, where either other people rediscovered this, or a similar thing, or in some case I probably forgot about the old one and filed another. As one of my comments in the first issue linked below says, I would love it if we could get all the stakeholders involved into a discussion with the goal of coming up with an answer to this.
There is also a PR that started with one potential change, and I believe the discussion on it led to a proposal for a different approach, one which would be a small p4c change, but I haven't thought about the details in a while to have a good evaluation of either of those proposed changes at this moment: In particular, this comment: #3228 (comment) mentions a specific approach that might be a good one to try. I have copied the text of that comment below for convenience: dmatousek I spoke with some folks at Intel including Han Wang about the underlying issue here, and he had a suggestion for an experiment to try: put the The only disadvantage I can think of to such an approach is that now P4_16 source code produced as the output of passes after LocalizeAllActions could cause errors when used as input to p4c. I do not know how serious that is, but perhaps having a command line option that skips the new |
@kfcripps This PR #4951 is intended to address this issue. Feel free to take a look at it, and review it if you are interested. It only issues error messages if you invoke a p4c command with the command line options to generate one or more P4Runtime API files. Without such options, there are no errors given for such programs, just as there are no errors for similar programs with two tables in the same control with the same |
@oleg-ran-amd Please take a look at #4951. This is related to issue # 4025 in our backend. |
@kfcripps @oleg-ran-amd Sorry for any confusion, but I would recommend we abandon PR #4951, and instead focus on #4975, which includes all of the changes of #4951 plus one more fix. |
If/when you do review PR #4975, this slide deck might help provide useful background on what is changing, what is not changing, and why: https://docs.google.com/presentation/d/1JqQciG8hWdd2UlbXbDENw36yfGGRk2LugjzRrbv6Sf4/edit?usp=sharing That link is in the first comment on PR #4975, but it is a big comment, so wanted to call it out to you. |
Just a reminder: You and I are probably the two people in the world who care most about this issue. My proposed PR #4975 is unlikely to move forward without someone reviewing it. This issue is likely to be even lower priority for everyone else reviewing p4c PRs. No rush on my part. |
@jafingerhut Sorry for the delay - I promise, I have not forgotten about this. 😃 Oleg is probably the best person to review your PR but I think he has been swamped lately. If he hasn't responded by the end of the Thanksgiving holiday, I will message him directly to remind him about this. I could also try to find time to review it myself but I think it would be great if other members on our team (in addition to just me and Anton) can get more involved with |
Now that #4975 is merged, I believe that fully addresses the statements made in the first comment of this issue. The behavior in the second comment here #4651 (comment) remains exactly as it was before #4975 was merged. That is the behavior by design of the pass LocalizeAllActions, which, while it is certainly possible to change, is not necessarily easy, and for some back ends, perhaps not even desirable to change. If you want the ability to make a compiler from what p4c offers, without using LocalizeAllActions, that is not something I am currently interested in working on, and don't expect to be any time later, either. You may want to consider creating a separate issue to track such an enhancement, if you want that. |
For example:
Per the P4-16 spec, shouldn't this result in an error message?
...
...
The text was updated successfully, but these errors were encountered: