-
Notifications
You must be signed in to change notification settings - Fork 82
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
Abstract methods access outer variables in Tofino #979
Comments
This is a known inconsistency between the spec and the implementation. Thanks for flagging it. |
This is a problem that has been known for at least 6 years; the design committee just recently accepted abstract methods without captured variables; we have to do some more work to add this capability in the official language. |
In what you would suggest, abstract methods may capture variables but only for reading. Is that correct? |
Unfortunately in practice people need them to also capture variables for writing. |
@mbudiu-vmw Could you tell me what synchronous and asynchronous state means, when mentioned here #802 (comment)? |
That is a complicated topic. I don't even remember whether I attempted to write it down at some point, as I said, it's been open for at least 6 years. And, as many complicated topics are, it may be that once you try to write down the rules you realize that you don't really understand the problem well (see our prior attempt to formalize pure functions, which split them into many different categories). I don't think a comment box for an issue is the right place to discuss this. |
In the interest of tidying up the set of active issues on the P4 specification repository, I'm marking this as "stalled" and closing it. Of course, we can always re-open it in the future if there is interest in resurrecting it. |
The Tofino architecture is inconsistent with the spec. The spec states that “The abstract methods can only use the supplied arguments or refer to values that are in the top-level scope”, but in the Tofino architecture it needs to allow developers to access outside variables in the
registerAction
’sapply
method. Specifically, it seems that users should be able to update a register value with some variables, and since there is no suchin
argument inapply
andexecute
, they need to access variables likehdr.ipv4.ipaddress
directly.Two possible ways to fix this: the P4 spec needs to be relaxed to allow reading values outside the scope and not in top level; the tofino.p4 needs to be updated to include the variables users want to read as
in
arguments.The text was updated successfully, but these errors were encountered: