-
Notifications
You must be signed in to change notification settings - Fork 445
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
Add pure/localState/packetStata annotations #2121
base: main
Are you sure you want to change the base?
Conversation
ChrisDodd
commented
Dec 30, 2019
- add annotations in appropriate places in v1mode.p4 and psa.p4
- fix resolveReferences to look at parameters
@@ -340,6 +348,7 @@ enum HashAlgorithm { | |||
} | |||
|
|||
@deprecated("Please use mark_to_drop(standard_metadata) instead.") | |||
@packetState |
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.
To be nit-picky here, the reason this is deprecated in v1model is because it isn't a legal P4_16 extern function at all. It violates the one restriction that externs have -- it accesses P4_16 program variables that are not parameters.
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 like this, but I think we should discuss @packetState
prior to merging.
p4include/psa.p4
Outdated
@@ -517,12 +526,15 @@ extern Checksum<W> { | |||
/// time the object is instantiated, that is, whenever the parser or control | |||
/// containing the Checksum object are applied. | |||
/// All state maintained by the Checksum object is independent per packet. | |||
@packetState |
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.
It looks to me like we may want this annotation to be on the extern itself rather than on each method.
Does it ever make sense to have only some methods of an extern be @packetState
?
bf457e3
to
b1eb760
Compare
In the interests of moving things forward here, if I apologize if I introduced confusion by describing the other kinds of annotations -- just my over-exuberance in looking for other broader kinds of categories that extern functions/methods fit into, regardless of whether they enabled compiler optimizations. |
The parts of these changes that add the As of this writing, there is currently no PR that makes the rest of these changes. I do not know if such a thing is of interest, either, until and unless there is a known compiler optimization use case for additional similar annotations. |
@ChrisDodd @mihaibudiu Does it seem reasonable to close this, since |
I have no problem closing this, but it is Chris' PR. |
b0943bd
to
8f56d73
Compare
- add annotations in appropriate places in v1mode.p4 and psa.p4 - fix resolveReferences to look at parameters
8f56d73
to
690438c
Compare